strong_migrations 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +5 -5
- data/lib/generators/strong_migrations/install_generator.rb +11 -0
- data/lib/generators/strong_migrations/templates/initializer.rb.tt +4 -0
- data/lib/strong_migrations.rb +1 -1
- data/lib/strong_migrations/checker.rb +1 -0
- data/lib/strong_migrations/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 947dda0ab2fa336611335b258b4eae34e7b60f38083e162fb6bf80d2237ce819
|
4
|
+
data.tar.gz: 6744411d6b2a33d5ee54b910ef60652fcb992cbb700a59a31da3eb48c2cb5322
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e1b51f910a02835ab0612f8be9714dce1dd1024acc3745a4465588447e6e12d8a4bdb2903c66f9c5f8ccc67bb6877ec231ad5979b304aff0ee34e5e4bd1f0a2
|
7
|
+
data.tar.gz: e739903401b7787ad66a929ff1f67b0e0b4ff9366571d25ad0349f680bf013adad95be38a1fc71c4f4039174b4ef7ee30764a9786e6b8677597a0d2bd6434749
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -45,7 +45,7 @@ Deploy the code, then wrap this step in a safety_assured { ... } block.
|
|
45
45
|
|
46
46
|
class RemoveColumn < ActiveRecord::Migration[6.0]
|
47
47
|
def change
|
48
|
-
safety_assured { remove_column :users, :name
|
48
|
+
safety_assured { remove_column :users, :name }
|
49
49
|
end
|
50
50
|
end
|
51
51
|
```
|
@@ -611,7 +611,7 @@ StrongMigrations.disable_check(:add_index)
|
|
611
611
|
|
612
612
|
Check the [source code](https://github.com/ankane/strong_migrations/blob/master/lib/strong_migrations.rb) for the list of keys.
|
613
613
|
|
614
|
-
## Down Migrations / Rollbacks
|
614
|
+
## Down Migrations / Rollbacks
|
615
615
|
|
616
616
|
By default, checks are disabled when migrating down. Enable them with:
|
617
617
|
|
@@ -707,11 +707,11 @@ Use the version from your latest migration.
|
|
707
707
|
If your development database version is different from production, you can specify the production version so the right checks run in development.
|
708
708
|
|
709
709
|
```ruby
|
710
|
-
StrongMigrations.
|
711
|
-
StrongMigrations.target_mysql_version = "8.0.12"
|
712
|
-
StrongMigrations.target_mariadb_version = "10.3.2"
|
710
|
+
StrongMigrations.target_version = 10 # or "8.0.12", "10.3.2", etc
|
713
711
|
```
|
714
712
|
|
713
|
+
The major version works well for Postgres, while the full version is recommended for MySQL and MariaDB.
|
714
|
+
|
715
715
|
For safety, this option only affects development and test environments. In other environments, the actual server version is always used.
|
716
716
|
|
717
717
|
## Analyze Tables
|
@@ -12,6 +12,17 @@ module StrongMigrations
|
|
12
12
|
def start_after
|
13
13
|
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
14
14
|
end
|
15
|
+
|
16
|
+
def target_version
|
17
|
+
case ActiveRecord::Base.connection_config[:adapter].to_s
|
18
|
+
when /mysql/
|
19
|
+
# could try to connect to database and check for MariaDB
|
20
|
+
# but this should be fine
|
21
|
+
'"8.0.12"'
|
22
|
+
else
|
23
|
+
"10"
|
24
|
+
end
|
25
|
+
end
|
15
26
|
end
|
16
27
|
end
|
17
28
|
end
|
@@ -10,6 +10,10 @@ StrongMigrations.statement_timeout = 1.hour
|
|
10
10
|
# Outdated statistics can sometimes hurt performance
|
11
11
|
StrongMigrations.auto_analyze = true
|
12
12
|
|
13
|
+
# Set the version of the production database
|
14
|
+
# so the right checks are run in development
|
15
|
+
# StrongMigrations.target_version = <%= target_version %>
|
16
|
+
|
13
17
|
# Add custom checks
|
14
18
|
# StrongMigrations.add_check do |method, args|
|
15
19
|
# if method == :add_index && args[0].to_s == "users"
|
data/lib/strong_migrations.rb
CHANGED
@@ -17,7 +17,7 @@ module StrongMigrations
|
|
17
17
|
class << self
|
18
18
|
attr_accessor :auto_analyze, :start_after, :checks, :error_messages,
|
19
19
|
:target_postgresql_version, :target_mysql_version, :target_mariadb_version,
|
20
|
-
:enabled_checks, :lock_timeout, :statement_timeout, :check_down
|
20
|
+
:enabled_checks, :lock_timeout, :statement_timeout, :check_down, :target_version
|
21
21
|
attr_writer :lock_timeout_limit
|
22
22
|
end
|
23
23
|
self.auto_analyze = false
|
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: 0.7.
|
4
|
+
version: 0.7.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: 2020-07-
|
13
|
+
date: 2020-07-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|