Module: OnlineMigrations::SchemaCache
- Defined in:
- lib/online_migrations/schema_cache.rb
Instance Method Summary collapse
- #clear_data_source_cache!(name) ⇒ Object
- #columns(table_name) ⇒ Object
- #indexes(table_name) ⇒ Object
- #primary_keys(table_name) ⇒ Object
Instance Method Details
#clear_data_source_cache!(name) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/online_migrations/schema_cache.rb', line 40 def clear_data_source_cache!(name) if (renamed_table = renamed_table?(name)) super(renamed_table) end if renamed_column?(name) super(column_rename_table(name)) end super end |
#columns(table_name) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/online_migrations/schema_cache.rb', line 16 def columns(table_name) if (renamed_table = renamed_table?(table_name)) super(renamed_table) elsif renamed_column?(table_name) columns = super(column_rename_table(table_name)) OnlineMigrations.config.column_renames[table_name].each do |old_column_name, new_column_name| duplicate_column(old_column_name, new_column_name, columns) end columns else super.reject { |column| column.name.end_with?("_for_type_change") } end end |
#indexes(table_name) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/online_migrations/schema_cache.rb', line 30 def indexes(table_name) if (renamed_table = renamed_table?(table_name)) super(renamed_table) elsif renamed_column?(table_name) super(column_rename_table(table_name)) else super end end |
#primary_keys(table_name) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/online_migrations/schema_cache.rb', line 6 def primary_keys(table_name) if (renamed_table = renamed_table?(table_name)) super(renamed_table) elsif renamed_column?(table_name) super(column_rename_table(table_name)) else super end end |