Class: ActiveRecord::Migration::Compatibility::V4_2
- Inherits:
-
V5_0
- Object
- 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
Methods inherited from V5_1
#change_column
Instance Method Details
#add_reference(**options) ⇒ Object
Also known as:
add_belongs_to
159
160
161
162
|
# File 'lib/active_record/migration/compatibility.rb', line 159
def add_reference(*, **options)
options[:index] ||= false
super
end
|
#add_timestamps(_, **options) ⇒ Object
165
166
167
168
|
# File 'lib/active_record/migration/compatibility.rb', line 165
def add_timestamps(_, **options)
options[:null] = true if options[:null].nil?
super
end
|
#change_table(table_name, options = {}) ⇒ Object
149
150
151
152
153
154
155
156
157
|
# File 'lib/active_record/migration/compatibility.rb', line 149
def change_table(table_name, options = {})
if block_given?
super do |t|
yield compatible_table_definition(t)
end
else
super
end
end
|
#create_table(table_name, options = {}) ⇒ Object
139
140
141
142
143
144
145
146
147
|
# File 'lib/active_record/migration/compatibility.rb', line 139
def create_table(table_name, options = {})
if block_given?
super do |t|
yield compatible_table_definition(t)
end
else
super
end
end
|
#index_exists?(table_name, column_name, options = {}) ⇒ Boolean
170
171
172
173
174
175
176
177
178
179
|
# File 'lib/active_record/migration/compatibility.rb', line 170
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
181
182
183
184
185
|
# File 'lib/active_record/migration/compatibility.rb', line 181
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
|