Module: DBNazi::AbstractAdapter::Adapter

Defined in:
lib/db_nazi/abstract_adapter.rb

Instance Method Summary collapse

Instance Method Details

#add_column(table_name, column_name, type, options = {}) ⇒ Object



17
18
19
20
# File 'lib/db_nazi/abstract_adapter.rb', line 17

def add_column(table_name, column_name, type, options = {})
  DBNazi.check_column(type, options)
  super
end

#add_index(table_name, column_name, options = {}) ⇒ Object



22
23
24
25
# File 'lib/db_nazi/abstract_adapter.rb', line 22

def add_index(table_name, column_name, options = {})
  DBNazi.check_index(options)
  super
end

#change_column(table_name, column_name, type, options = {}) ⇒ Object



27
28
29
30
# File 'lib/db_nazi/abstract_adapter.rb', line 27

def change_column(table_name, column_name, type, options = {})
  DBNazi.check_column(type, options)
  super
end

#change_column_default(table_name, column_name, default) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/db_nazi/abstract_adapter.rb', line 32

def change_column_default(table_name, column_name, default)
  original_nullability = DBNazi.require_nullability
  begin
    DBNazi.require_nullability = false
    return_val = super
  ensure
    DBNazi.require_nullability = original_nullability
    return_val
  end
end

#create_table(name) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/db_nazi/abstract_adapter.rb', line 43

def create_table(name, *)
  if name.to_s == ActiveRecord::Migrator.schema_migrations_table_name.to_s
    DBNazi.disable { super }
  else
    super
  end
end