Sha256: 2bfbacedb31bde284fd46a94641ef208f2aae5c5ee082ee175848379d9977f81

Contents?: true

Size: 840 Bytes

Versions: 4

Compression:

Stored size: 840 Bytes

Contents

module StrongMigrations
  module Migration
    def migrate(direction)
      strong_migrations_checker.direction = direction
      super
      connection.begin_db_transaction if strong_migrations_checker.transaction_disabled
    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

4 entries across 4 versions & 1 rubygems

Version Path
strong_migrations-0.7.6 lib/strong_migrations/migration.rb
strong_migrations-0.7.5 lib/strong_migrations/migration.rb
strong_migrations-0.7.4 lib/strong_migrations/migration.rb
strong_migrations-0.7.3 lib/strong_migrations/migration.rb