Class: ActiveRecord::Migration::Compatibility::V6_1

Inherits:
V7_0
  • Object
show all
Defined in:
lib/active_record/migration/compatibility.rb

Direct Known Subclasses

V6_0

Defined Under Namespace

Modules: TableDefinition Classes: PostgreSQLCompat

Instance Method Summary collapse

Methods inherited from V7_0

#add_foreign_key, #add_index, #add_reference, #change_column_null, #create_table, #disable_extension, #rename_table

Instance Method Details

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



168
169
170
171
172
173
174
175
# File 'lib/active_record/migration/compatibility.rb', line 168

def add_column(table_name, column_name, type, **options)
  if type == :datetime
    options[:precision] ||= nil
  end

  type = PostgreSQLCompat.compatible_timestamp_type(type, connection)
  super
end

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



177
178
179
180
181
182
183
184
# File 'lib/active_record/migration/compatibility.rb', line 177

def change_column(table_name, column_name, type, **options)
  if type == :datetime
    options[:precision] ||= nil
  end

  type = PostgreSQLCompat.compatible_timestamp_type(type, connection)
  super
end