class ActiveRecord::Migration::Compatibility::V5_0
def create_table(table_name, **options)
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 ["Mysql2", "Trilogy"].include?(connection.adapter_name) && 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 super end