Class: ActiveRecord::Migration::Compatibility::V5_1

Inherits:
V5_2 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

Direct Known Subclasses

V5_0

Instance Method Summary collapse

Methods inherited from V5_2

#add_timestamps, #change_table, #create_join_table

Methods inherited from V6_0

#add_reference, #change_table, #create_join_table

Methods inherited from V6_1

#add_column

Instance Method Details

#change_column(table_name, column_name, type, **options) ⇒ Object



225
226
227
228
229
230
231
232
233
234
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/migration/compatibility.rb', line 225

def change_column(table_name, column_name, type, **options)
  if connection.adapter_name == "PostgreSQL"
    super(table_name, column_name, type, **options.except(:default, :null, :comment))
    connection.change_column_default(table_name, column_name, options[:default]) if options.key?(:default)
    connection.change_column_null(table_name, column_name, options[:null], options[:default]) if options.key?(:null)
    connection.change_column_comment(table_name, column_name, options[:comment]) if options.key?(:comment)
  else
    super
  end
end

#create_table(table_name, **options) ⇒ Object



236
237
238
239
240
241
242
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/migration/compatibility.rb', line 236

def create_table(table_name, **options)
  if connection.adapter_name == "Mysql2"
    super(table_name, options: "ENGINE=InnoDB", **options)
  else
    super
  end
end