Class: ActiveRecord::Migration::Compatibility::V6_0

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

Direct Known Subclasses

V5_2

Defined Under Namespace

Modules: SQLite3, TableDefinition Classes: ReferenceDefinition

Instance Method Summary collapse

Methods inherited from V6_1

#add_column

Instance Method Details

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



149
150
151
152
153
154
155
156
157
# File 'lib/active_record/migration/compatibility.rb', line 149

def add_reference(table_name, ref_name, **options)
  if connection.adapter_name == "SQLite"
    reference_definition = ReferenceDefinition.new(ref_name, type: :integer, **options)
  else
    reference_definition = ReferenceDefinition.new(ref_name, **options)
  end

  reference_definition.add_to(connection.update_table_definition(table_name, self))
end

#change_table(table_name, **options) ⇒ Object



133
134
135
136
137
138
139
# File 'lib/active_record/migration/compatibility.rb', line 133

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

#create_join_table(table_1, table_2, **options) ⇒ Object



141
142
143
144
145
146
147
# File 'lib/active_record/migration/compatibility.rb', line 141

def create_join_table(table_1, table_2, **options)
  if block_given?
    super { |t| yield compatible_table_definition(t) }
  else
    super
  end
end

#create_table(table_name, **options) ⇒ Object



125
126
127
128
129
130
131
# File 'lib/active_record/migration/compatibility.rb', line 125

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