Skip to content

Commit

Permalink
Added comment [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Nov 7, 2024
1 parent 2dc92b9 commit 3f17301
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/strong_migrations/safe_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def safe_add_reference(table, reference, *args, **options)
def safe_add_foreign_key(from_table, to_table, *args, **options)
@migration.reversible do |dir|
dir.up do
# validate option is ignored for Active Record < 7.1
# https://github.com/rails/rails/pull/45896
if ar_version < 7.1 || !connection.foreign_key_exists?(from_table, to_table, **options.merge(validate: false))
@migration.add_foreign_key(from_table, to_table, *args, **options.merge(validate: false))
end
Expand Down

0 comments on commit 3f17301

Please sign in to comment.