Skip to content

Commit

Permalink
Override revert method to check for version safety
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmenden committed Oct 16, 2023
1 parent 54a6107 commit ef01e2c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/strong_migrations/migration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ def method_missing(method, *args)
end
ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)

def revert(*migration_classes, &block)
if strong_migrations_checker.version_safe?
safety_assured { super(*migration_classes, &block) }
else
super(*migration_classes, &block)
end
end

def safety_assured
strong_migrations_checker.class.safety_assured do
yield
Expand Down

0 comments on commit ef01e2c

Please sign in to comment.