提交 2aa9fd07 编写于 作者: R Ryuta Kamizono

Deprecate `ColumnDumper#migration_keys`

`ColumnDumper#migration_keys` was extracted to customize keys for
standardized column arguments widths. But the feature was removed in
df84e986. The internal method is no longer used for that.
上级 aff5e524
* Deprecate `ColumnDumper#migration_keys`.
*Ryuta Kamizono*
* Fix `association_primary_key_type` for reflections with symbol primary key
Fixes #27864
......
......@@ -49,9 +49,10 @@ def prepare_column_options(column)
end
# Lists the valid migration options
def migration_keys
[:limit, :precision, :scale, :default, :null, :collation, :comment]
def migration_keys # :nodoc:
column_options_keys
end
deprecate :migration_keys
private
......
......@@ -122,7 +122,7 @@ def column_exists?(table_name, column_name, type = nil, options = {})
checks = []
checks << lambda { |c| c.name == column_name }
checks << lambda { |c| c.type == type } if type
migration_keys.each do |attr|
column_options_keys.each do |attr|
checks << lambda { |c| c.send(attr) == options[attr] } if options.key?(attr)
end
......@@ -1172,6 +1172,9 @@ def change_column_comment(table_name, column_name, comment) #:nodoc:
end
private
def column_options_keys
[:limit, :precision, :scale, :default, :null, :collation, :comment]
end
def add_index_sort_order(quoted_columns, **options)
if order = options[:order]
......
module ActiveRecord
module ConnectionAdapters
module MySQL
module ColumnDumper
module ColumnDumper # :nodoc:
def column_spec_for_primary_key(column)
spec = super
if [:integer, :bigint].include?(schema_type(column)) && !column.auto_increment?
......
module ActiveRecord
module ConnectionAdapters
module PostgreSQL
module ColumnDumper
module ColumnDumper # :nodoc:
def column_spec_for_primary_key(column)
spec = super
if schema_type(column) == :uuid
......
module ActiveRecord
module ConnectionAdapters
module SQLite3
module ColumnDumper
module ColumnDumper # :nodoc:
private
def default_primary_key?(column)
......
......@@ -1138,4 +1138,8 @@ def test_deprecate_initialize_internal_tables
assert_deprecated { ActiveRecord::Base.connection.initialize_schema_migrations_table }
assert_deprecated { ActiveRecord::Base.connection.initialize_internal_metadata_table }
end
def test_deprecate_migration_keys
assert_deprecated { ActiveRecord::Base.connection.migration_keys }
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册