mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Unify create_table method signature to take keyword arguments
This commit is contained in:
parent
9bce8c3c02
commit
69712e82c8
2 changed files with 3 additions and 3 deletions
|
@ -379,7 +379,7 @@ module ActiveRecord
|
||||||
|
|
||||||
t1_ref, t2_ref = [table_1, table_2].map { |t| t.to_s.singularize }
|
t1_ref, t2_ref = [table_1, table_2].map { |t| t.to_s.singularize }
|
||||||
|
|
||||||
create_table(join_table_name, options.merge!(id: false)) do |td|
|
create_table(join_table_name, **options.merge!(id: false)) do |td|
|
||||||
td.references t1_ref, **column_options
|
td.references t1_ref, **column_options
|
||||||
td.references t2_ref, **column_options
|
td.references t2_ref, **column_options
|
||||||
yield td if block_given?
|
yield td if block_given?
|
||||||
|
|
|
@ -100,7 +100,7 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_table(table_name, options = {})
|
def create_table(table_name, **options)
|
||||||
if connection.adapter_name == "Mysql2"
|
if connection.adapter_name == "Mysql2"
|
||||||
super(table_name, options: "ENGINE=InnoDB", **options)
|
super(table_name, options: "ENGINE=InnoDB", **options)
|
||||||
else
|
else
|
||||||
|
@ -122,7 +122,7 @@ module ActiveRecord
|
||||||
alias :belongs_to :references
|
alias :belongs_to :references
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_table(table_name, options = {})
|
def create_table(table_name, **options)
|
||||||
if connection.adapter_name == "PostgreSQL"
|
if connection.adapter_name == "PostgreSQL"
|
||||||
if options[:id] == :uuid && !options.key?(:default)
|
if options[:id] == :uuid && !options.key?(:default)
|
||||||
options[:default] = "uuid_generate_v4()"
|
options[:default] = "uuid_generate_v4()"
|
||||||
|
|
Loading…
Reference in a new issue