strong_migrations 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +6 -0
- data/lib/strong_migrations/adapters/abstract_adapter.rb +17 -1
- data/lib/strong_migrations/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a296161cd1d5cdd070c94c34bd250feb2d62cb7b5274205007bab92e50dc7d0a
|
4
|
+
data.tar.gz: e95730e625ed31bb3745c0c55fddf4aa2cd6d7d99607add097d23ae1181a8b50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '03479a3996622262cad8eab0843f6fdd266e041d854ab49ced8dd334e6c9709556f6887f7708d1eeab87f98524bb558e813457f5f0cbb4c16323557353438680'
|
7
|
+
data.tar.gz: 263a6238d3cc34d1211f7f6c6410248f8ee104e475f04f5e3687efb8602389ab26b12ec9155a6e782fc828e733af85b9315e9a282b5589d39f5891b46a5a83e6
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -824,6 +824,12 @@ The major version works well for Postgres, while the full version is recommended
|
|
824
824
|
|
825
825
|
For safety, this option only affects development and test environments. In other environments, the actual server version is always used.
|
826
826
|
|
827
|
+
If your app has multiple databases with different versions, with Rails 6.1+, you can use:
|
828
|
+
|
829
|
+
```ruby
|
830
|
+
StrongMigrations.target_version = {primary: 13, catalog: 15}
|
831
|
+
```
|
832
|
+
|
827
833
|
## Analyze Tables
|
828
834
|
|
829
835
|
Analyze tables automatically (to update planner statistics) after an index is added. Create an initializer with:
|
@@ -50,7 +50,23 @@ module StrongMigrations
|
|
50
50
|
target_version ||= StrongMigrations.target_version
|
51
51
|
version =
|
52
52
|
if target_version && StrongMigrations.developer_env?
|
53
|
-
target_version.
|
53
|
+
if target_version.is_a?(Hash)
|
54
|
+
# Active Record 6.0 supports multiple databases
|
55
|
+
# but connection.pool.spec.name always returns "primary"
|
56
|
+
# in migrations with rails db:migrate
|
57
|
+
if ActiveRecord::VERSION::STRING.to_f < 6.1
|
58
|
+
# error class is not shown in db:migrate output so ensure message is descriptive
|
59
|
+
raise StrongMigrations::Error, "StrongMigrations.target_version does not support multiple databases for Active Record < 6.1"
|
60
|
+
end
|
61
|
+
|
62
|
+
db_config_name = connection.pool.db_config.name
|
63
|
+
target_version.stringify_keys.fetch(db_config_name) do
|
64
|
+
# error class is not shown in db:migrate output so ensure message is descriptive
|
65
|
+
raise StrongMigrations::Error, "StrongMigrations.target_version is not configured for :#{db_config_name} database"
|
66
|
+
end.to_s
|
67
|
+
else
|
68
|
+
target_version.to_s
|
69
|
+
end
|
54
70
|
else
|
55
71
|
yield
|
56
72
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strong_migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2023-01-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
|
-
rubygems_version: 3.
|
78
|
+
rubygems_version: 3.4.1
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: Catch unsafe migrations in development
|