method
create_table
v5.2.3 -
Show latest stable
- Class:
ActiveRecord::Migration::Compatibility::V5_0
create_table(table_name, options = {})public
No documentation available.
# File activerecord/lib/active_record/migration/compatibility.rb, line 52
def create_table(table_name, options = {})
if connection.adapter_name == "PostgreSQL"
if options[:id] == :uuid && !options.key?(:default)
options[:default] = "uuid_generate_v4()"
end
end
unless connection.adapter_name == "Mysql2" && options[:id] == :bigint
if [:integer, :bigint].include?(options[:id]) && !options.key?(:default)
options[:default] = nil
end
end
# Since 5.1 PostgreSQL adapter uses bigserial type for primary
# keys by default and MySQL uses bigint. This compat layer makes old migrations utilize
# serial/int type instead -- the way it used to work before 5.1.
unless options.key?(:id)
options[:id] = :integer
end
if block_given?
super do |t|
yield compatible_table_definition(t)
end
else
super
end
end