From ef01e2c352e27b98c7debca8ab7f1ea6e2fa72b7 Mon Sep 17 00:00:00 2001 From: Josh Menden Date: Sun, 15 Oct 2023 22:22:08 -0600 Subject: [PATCH] Override revert method to check for version safety --- lib/strong_migrations/migration.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/strong_migrations/migration.rb b/lib/strong_migrations/migration.rb index 7a1c6f97..d013efd1 100644 --- a/lib/strong_migrations/migration.rb +++ b/lib/strong_migrations/migration.rb @@ -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