Class: ActiveRecord::Migration::Compatibility::V4_2

Inherits:
V5_0 show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/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

Methods inherited from V6_0

#change_table, #create_join_table, #create_table

Methods inherited from V6_1

#add_column, #create_table

Instance Method Details

#add_reference(table_name, ref_name, **options) ⇒ Object Also known as: add_belongs_to



324
325
326
327
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/migration/compatibility.rb', line 324

def add_reference(table_name, ref_name, **options)
  options[:index] ||= false
  super
end

#add_timestamps(table_name, **options) ⇒ Object



330
331
332
333
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/migration/compatibility.rb', line 330

def add_timestamps(table_name, **options)
  options[:null] = true if options[:null].nil?
  super
end

#index_exists?(table_name, column_name, **options) ⇒ Boolean

Returns:

  • (Boolean)


335
336
337
338
339
340
341
342
343
344
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/migration/compatibility.rb', line 335

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, column_name = nil, **options) ⇒ Object



346
347
348
349
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/migration/compatibility.rb', line 346

def remove_index(table_name, column_name = nil, **options)
  options[:name] = index_name_for_remove(table_name, column_name, options)
  super
end