Class: ActiveRecord::Migration::Compatibility::V4_2
Do not use. This class is for internal use only.
| Relationships & Source Files | |
| Namespace Children | |
|
Modules:
| |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
|
|
|
Instance Chain:
self,
V5_0,
V5_1,
V5_2,
V6_0,
V6_1,
V7_0,
V7_0::LegacyIndexName,
V7_1,
V7_2,
V8_0,
V8_0::RemoveForeignKeyColumnMatch,
V8_1,
::ActiveRecord::Migration::Current,
Migration
|
|
| Inherits: |
ActiveRecord::Migration::Compatibility::V5_0
|
| Defined in: | activerecord/lib/active_record/migration/compatibility.rb |
Instance Method Summary
-
#add_belongs_to(table_name, ref_name, **options)
Alias for #add_reference.
- #add_reference(table_name, ref_name, **options) (also: #add_belongs_to)
- #add_timestamps(table_name, **options)
- #index_exists?(table_name, column_name = nil, **options) ⇒ Boolean
- #remove_index(table_name, column_name = nil, **options)
- #compatible_table_definition(t) private
- #index_name_for_remove(table_name, column_name, options) private
V5_0 - Inherited
| #add_belongs_to | Alias for V5_0#add_reference. |
| #add_column, #add_reference, #create_join_table, #create_table, #compatible_table_definition | |
V5_1 - Inherited
V5_2 - Inherited
V6_0 - Inherited
V6_1 - Inherited
V7_0 - Inherited
V7_0::LegacyIndexName - Included
V8_0 - Inherited
V8_0::RemoveForeignKeyColumnMatch - Included
::ActiveRecord::Migration::Current - Inherited
Instance Method Details
#add_belongs_to(table_name, ref_name, **options)
Alias for #add_reference.
# File 'activerecord/lib/active_record/migration/compatibility.rb', line 453
alias :add_belongs_to :add_reference
#add_reference(table_name, ref_name, **options) Also known as: #add_belongs_to
[ GitHub ]# File 'activerecord/lib/active_record/migration/compatibility.rb', line 449
def add_reference(table_name, ref_name, **) [:index] ||= false super end
#add_timestamps(table_name, **options)
[ GitHub ]# File 'activerecord/lib/active_record/migration/compatibility.rb', line 455
def (table_name, **) [:null] = true if [:null].nil? super end
#compatible_table_definition(t) (private)
[ GitHub ]# File 'activerecord/lib/active_record/migration/compatibility.rb', line 477
def compatible_table_definition(t) t.singleton_class.prepend(TableDefinition) super end
#index_exists?(table_name, column_name = nil, **options) ⇒ Boolean
# File 'activerecord/lib/active_record/migration/compatibility.rb', line 460
def index_exists?(table_name, column_name = nil, **) column_names = Array(column_name).map(&:to_s) [:name] = if [:name].present? [:name].to_s else connection.index_name(table_name, column: column_names) end super end
#index_name_for_remove(table_name, column_name, options) (private)
[ GitHub ]# File 'activerecord/lib/active_record/migration/compatibility.rb', line 482
def index_name_for_remove(table_name, column_name, ) index_name = connection.index_name(table_name, column_name || ) unless connection.index_name_exists?(table_name, index_name) if .key?(:name) = .except(:column) index_name_without_column = connection.index_name(table_name, ) if connection.index_name_exists?(table_name, index_name_without_column) return index_name_without_column end end raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' does not exist" end index_name end
#remove_index(table_name, column_name = nil, **options)
[ GitHub ]# File 'activerecord/lib/active_record/migration/compatibility.rb', line 471
def remove_index(table_name, column_name = nil, **) [:name] = index_name_for_remove(table_name, column_name, ) super end