Class: ActiveRecord::ConnectionAdapters::AbstractAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/foreign_key_saver/foreign_key_saver_patches.rb

Instance Method Summary collapse

Instance Method Details

#drop_table_with_foreign_keys(table_name, options = {}) ⇒ Object



90
91
92
93
# File 'lib/foreign_key_saver/foreign_key_saver_patches.rb', line 90

def drop_table_with_foreign_keys(table_name, options = {})
  remove_foreign_key_constraints_referencing(table_name) if tables.include?(table_name) # the if is an optimization for the sake of create_table with :force => true, which is crucial for db:test:prepare performance on mysql as mysql's INFORMATION_SCHEMA implementation is excrutiatingly slow; it's not needed for postgres, but does give a small boost to performance there too
  drop_table_without_foreign_keys(table_name, options)
end

#quote_column_names(*column_names) ⇒ Object



86
87
88
# File 'lib/foreign_key_saver/foreign_key_saver_patches.rb', line 86

def quote_column_names(*column_names)
  column_names.flatten.map {|column_name| quote_column_name(column_name)} * ', '
end