strong_migrations 1.4.3 → 1.4.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cfd384b72ffa6aa5ca1b7ed100ecfd9a7eb5f76f5ae1297454f123504629079
4
- data.tar.gz: fc18dd031a7b25879ef769c4a96ef006778685d6203d2ae76ca2433c608a240f
3
+ metadata.gz: 7444023bd5f0829a289ebc9d222a28f041a4e3789224438f9fd6bffa01fa6668
4
+ data.tar.gz: feb5010616cc8ef6cf36088be7a67bb0d74272cde79d0e9a0a442272bfa92d99
5
5
  SHA512:
6
- metadata.gz: bdc1870c87c77070f1ecc76347139e44295a236548f65619ad842e943977319e74517462cdddd62527b353a0a85f039968f26235463c99d5f50fedc75d062d1f
7
- data.tar.gz: baec22cb082ffae658824bc9669dabd5141b8cc6a6502388c37e8e6ab85124eb10655731cb2ab3f520fc3864a580190e4c6a17ff422c1adc267d44f367ce9ab0
6
+ metadata.gz: '0599a3fef628ec724471ef53b7ad7358831e6b638bdd0ca3b7cb79c1b416da6c044793ecca5475f5e602e8a7d1235ced3ff3fda526f31b9c4a56990c8531f9b4'
7
+ data.tar.gz: 6aac91ecb348c6a04c25511adf7df5d3e97823f6b9acdfbfd86bac50c4f5856f15fdcc271f00d0fc6f1e5d2cfdbaf3da5e056b1476aaf9b224e7df89b9737e01
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.4.4 (2023-03-08)
2
+
3
+ - Fixed `add_foreign_key` with `name` and `column` options with `safe_by_default`
4
+
1
5
  ## 1.4.3 (2023-02-19)
2
6
 
3
7
  - Fixed check for `change_column` to account for charset with MySQL and MariaDB
data/README.md CHANGED
@@ -224,7 +224,7 @@ And some in MySQL and MariaDB:
224
224
 
225
225
  Type | Safe Changes
226
226
  --- | ---
227
- `string` | Increasing `:limit` from under 63 up to 63, increasing `:limit` from over 63 to the max (the threshold may be different if using an encoding other than `utf8mb4`)
227
+ `string` | Increasing `:limit` from under 63 up to 63, increasing `:limit` from over 63 to the max (the threshold can be different if using an encoding other than `utf8mb4` - for instance, it’s 85 for `utf8mb3` and 255 for `latin1`)
228
228
 
229
229
  #### Good
230
230
 
@@ -48,10 +48,20 @@ module StrongMigrations
48
48
  dir.up do
49
49
  @migration.add_foreign_key(from_table, to_table, *args, **options.merge(validate: false))
50
50
  disable_transaction
51
- @migration.validate_foreign_key(from_table, to_table)
51
+ validate_options = options.slice(:column, :name)
52
+ if ActiveRecord::VERSION::MAJOR >= 6
53
+ @migration.validate_foreign_key(from_table, to_table, **validate_options)
54
+ else
55
+ @migration.validate_foreign_key(from_table, validate_options.any? ? validate_options : to_table)
56
+ end
52
57
  end
53
58
  dir.down do
54
- @migration.remove_foreign_key(from_table, to_table)
59
+ remove_options = options.slice(:column, :name)
60
+ if ActiveRecord::VERSION::MAJOR >= 6
61
+ @migration.remove_foreign_key(from_table, to_table, **remove_options)
62
+ else
63
+ @migration.remove_foreign_key(from_table, remove_options.any? ? remove_options : to_table)
64
+ end
55
65
  end
56
66
  end
57
67
  end
@@ -1,3 +1,3 @@
1
1
  module StrongMigrations
2
- VERSION = "1.4.3"
2
+ VERSION = "1.4.4"
3
3
  end
@@ -2,22 +2,22 @@
2
2
  require "active_support"
3
3
 
4
4
  # adapters
5
- require "strong_migrations/adapters/abstract_adapter"
6
- require "strong_migrations/adapters/mysql_adapter"
7
- require "strong_migrations/adapters/mariadb_adapter"
8
- require "strong_migrations/adapters/postgresql_adapter"
5
+ require_relative "strong_migrations/adapters/abstract_adapter"
6
+ require_relative "strong_migrations/adapters/mysql_adapter"
7
+ require_relative "strong_migrations/adapters/mariadb_adapter"
8
+ require_relative "strong_migrations/adapters/postgresql_adapter"
9
9
 
10
10
  # modules
11
- require "strong_migrations/checks"
12
- require "strong_migrations/safe_methods"
13
- require "strong_migrations/checker"
14
- require "strong_migrations/database_tasks"
15
- require "strong_migrations/migration"
16
- require "strong_migrations/migrator"
17
- require "strong_migrations/version"
11
+ require_relative "strong_migrations/checks"
12
+ require_relative "strong_migrations/safe_methods"
13
+ require_relative "strong_migrations/checker"
14
+ require_relative "strong_migrations/database_tasks"
15
+ require_relative "strong_migrations/migration"
16
+ require_relative "strong_migrations/migrator"
17
+ require_relative "strong_migrations/version"
18
18
 
19
19
  # integrations
20
- require "strong_migrations/railtie" if defined?(Rails)
20
+ require_relative "strong_migrations/railtie" if defined?(Rails)
21
21
 
22
22
  module StrongMigrations
23
23
  class Error < StandardError; end
@@ -86,7 +86,7 @@ module StrongMigrations
86
86
  end
87
87
 
88
88
  # load error messages
89
- require "strong_migrations/error_messages"
89
+ require_relative "strong_migrations/error_messages"
90
90
 
91
91
  ActiveSupport.on_load(:active_record) do
92
92
  ActiveRecord::Migration.prepend(StrongMigrations::Migration)
@@ -96,6 +96,6 @@ ActiveSupport.on_load(:active_record) do
96
96
  ActiveRecord::Tasks::DatabaseTasks.singleton_class.prepend(StrongMigrations::DatabaseTasks)
97
97
  end
98
98
 
99
- require "strong_migrations/schema_dumper"
99
+ require_relative "strong_migrations/schema_dumper"
100
100
  ActiveRecord::SchemaDumper.prepend(StrongMigrations::SchemaDumper)
101
101
  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.3
4
+ version: 1.4.4
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: 2023-02-19 00:00:00.000000000 Z
13
+ date: 2023-03-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord