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

Inherits:
V7_0
  • Object
show all
Defined in:
activerecord/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_index, #change_column, #change_column_null, #disable_extension, #rename_table

Instance Method Details

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



165
166
167
168
169
170
171
172
# File 'activerecord/lib/active_record/migration/compatibility.rb', line 165

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_table(table_name, **options) ⇒ Object



182
183
184
185
186
187
188
# File 'activerecord/lib/active_record/migration/compatibility.rb', line 182

def change_table(table_name, **options)
  if block_given?
    super { |t| yield compatible_table_definition(t) }
  else
    super
  end
end

#create_table(table_name, **options) ⇒ Object



174
175
176
177
178
179
180
# File 'activerecord/lib/active_record/migration/compatibility.rb', line 174

def create_table(table_name, **options)
  if block_given?
    super { |t| yield compatible_table_definition(t) }
  else
    super
  end
end