Module: DBNazi::MigrationProxy

Defined in:
lib/db_nazi/migration_proxy.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
# File 'lib/db_nazi/migration_proxy.rb', line 3

def self.included(base)
  base.class_eval do
    alias migrate_without_db_nazi migrate
    alias migrate migrate_with_db_nazi
  end
end

Instance Method Details

#migrate_with_db_nazi(direction) ⇒ Object



10
11
12
13
14
15
# File 'lib/db_nazi/migration_proxy.rb', line 10

def migrate_with_db_nazi(direction)
  action = DBNazi.enabled_for_migration?(migration, version) ? :enable : :disable
  DBNazi.send(action) do
    migrate_without_db_nazi(direction)
  end
end