Skip to content

Commit 5f3348d

Browse files
committed
Add changelog
1 parent 8dc7755 commit 5f3348d

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

activerecord/CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
1+
* Enable experimental support for models to connect to and query databases
2+
with different adapters.
3+
4+
Previously, models cached many adapter specific values which would prevent
5+
making queries against different database types. Now, those caches are per
6+
`schema-context`, which can be configured in `database.yml`:
7+
8+
```yaml
9+
primary:
10+
adapter: trilogy
11+
database: myapp_development
12+
primary_pg:
13+
adapter: postgresql
14+
database: myapp_development
15+
schema_context: pg
16+
```
17+
18+
This enables models to connect to both MySQL and PostgreSQL databases in the
19+
same application, and query them successfully:
20+
21+
```ruby
22+
class User < ApplicationRecord
23+
connects_to shards: {
24+
mysql: { writing: :primary, reading: :primary },
25+
pg: { writing: :primary_pg, reading: :primary_pg },
26+
}
27+
end
28+
29+
User.connected_to(shard: :mysql) { User.first } # queries MySQL
30+
User.connected_to(shard: :pg) { User.first } # queries PostgreSQL
31+
```
32+
33+
*Hartley McGuire*
34+
135
* Support PostgreSQL `RESET` on readonly queries.
236

337
```ruby

0 commit comments

Comments
 (0)