Class: ActiveRecord::Migration::Compatibility::V4_2
- Inherits:
-
V5_0
- Object
- V5_2
- V5_1
- V5_0
- ActiveRecord::Migration::Compatibility::V4_2
show all
- Defined in:
- lib/active_record/migration/compatibility.rb
Defined Under Namespace
Modules: TableDefinition
Instance Method Summary
collapse
Methods inherited from V5_0
#add_column, #create_join_table, #create_table
Methods inherited from V5_1
#change_column, #create_table
Methods inherited from V5_2
#change_table, #create_join_table, #create_table
Instance Method Details
#add_reference(table_name, ref_name, **options) ⇒ Object
Also known as:
add_belongs_to
186
187
188
189
|
# File 'lib/active_record/migration/compatibility.rb', line 186
def add_reference(table_name, ref_name, **options)
options[:index] ||= false
super
end
|
#add_timestamps(table_name, **options) ⇒ Object
192
193
194
195
|
# File 'lib/active_record/migration/compatibility.rb', line 192
def add_timestamps(table_name, **options)
options[:null] = true if options[:null].nil?
super
end
|
#index_exists?(table_name, column_name, options = {}) ⇒ Boolean
197
198
199
200
201
202
203
204
205
206
|
# File 'lib/active_record/migration/compatibility.rb', line 197
def index_exists?(table_name, column_name, options = {})
column_names = Array(column_name).map(&:to_s)
options[:name] =
if options[:name].present?
options[:name].to_s
else
connection.index_name(table_name, column: column_names)
end
super
end
|
#remove_index(table_name, options = {}) ⇒ Object
208
209
210
211
212
|
# File 'lib/active_record/migration/compatibility.rb', line 208
def remove_index(table_name, options = {})
options = { column: options } unless options.is_a?(Hash)
options[:name] = index_name_for_remove(table_name, options)
super(table_name, options)
end
|