Sha256: 46b6cfdc4a69de69d75878f1444e9201a3c4ed0f4389e9933dee1d6e9a1e9645

Contents?: true

Size: 752 Bytes

Versions: 7

Compression:

Stored size: 752 Bytes

Contents

module StrongMigrations
  module Migration
    def migrate(direction)
      strong_migrations_checker.direction = direction
      super
    end

    def method_missing(method, *args)
      strong_migrations_checker.perform(method, *args) do
        super
      end
    end
    ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)

    def safety_assured
      strong_migrations_checker.safety_assured do
        yield
      end
    end

    def stop!(message, header: "Custom check")
      raise StrongMigrations::UnsafeMigration, "\n=== #{header} #strong_migrations ===\n\n#{message}\n"
    end

    private

    def strong_migrations_checker
      @strong_migrations_checker ||= StrongMigrations::Checker.new(self)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
strong_migrations-0.7.2 lib/strong_migrations/migration.rb
strong_migrations-0.7.1 lib/strong_migrations/migration.rb
strong_migrations-0.7.0 lib/strong_migrations/migration.rb
strong_migrations-0.6.8 lib/strong_migrations/migration.rb
strong_migrations-0.6.7 lib/strong_migrations/migration.rb
strong_migrations-0.6.6 lib/strong_migrations/migration.rb
strong_migrations-0.6.5 lib/strong_migrations/migration.rb