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
161
162
163
164
|
# File 'lib/active_record/migration/compatibility.rb', line 161
def add_reference(*, **options)
options[:index] ||= false
super
end
|
#add_timestamps(_, **options) ⇒ Object
167
168
169
170
|
# File 'lib/active_record/migration/compatibility.rb', line 167
def add_timestamps(_, **options)
options[:null] = true if options[:null].nil?
super
end
|
#change_table(table_name, options = {}) ⇒ Object
151
152
153
154
155
156
157
158
159
|
# File 'lib/active_record/migration/compatibility.rb', line 151
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
141
142
143
144
145
146
147
148
149
|
# File 'lib/active_record/migration/compatibility.rb', line 141
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
172
173
174
175
176
177
178
179
180
181
|
# File 'lib/active_record/migration/compatibility.rb', line 172
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
index_name(table_name, column: column_names)
end
super
end
|
#remove_index(table_name, options = {}) ⇒ Object
183
184
185
186
187
|
# File 'lib/active_record/migration/compatibility.rb', line 183
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
|