diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-02-01 08:33:15 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-02-07 08:23:21 +0900 |
commit | 2aa9fd0718fa8fac75d25e87579e48e4740f915a (patch) | |
tree | 3a3592a2f30c22a4ff87a75386a6ceaf03229d3f | |
parent | aff5e52484da7b4c2bc26552eb02222513d3976b (diff) | |
download | rails-2aa9fd0718fa8fac75d25e87579e48e4740f915a.tar.gz rails-2aa9fd0718fa8fac75d25e87579e48e4740f915a.tar.bz2 rails-2aa9fd0718fa8fac75d25e87579e48e4740f915a.zip |
Deprecate `ColumnDumper#migration_keys`
`ColumnDumper#migration_keys` was extracted to customize keys for
standardized column arguments widths. But the feature was removed in
df84e98. The internal method is no longer used for that.
7 files changed, 18 insertions, 6 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index c6db01df60..e4fb363da5 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,7 @@ +* Deprecate `ColumnDumper#migration_keys`. + + *Ryuta Kamizono* + * Fix `association_primary_key_type` for reflections with symbol primary key Fixes #27864 diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb index d6c912a69e..f0f4b5e565 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb @@ -49,9 +49,10 @@ module ActiveRecord 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 diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index d7e2818e35..7d602faf30 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -122,7 +122,7 @@ module ActiveRecord 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 @@ module ActiveRecord 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] diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb index 7a277b8cfd..3a3b65c2d0 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb @@ -1,7 +1,7 @@ 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? diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb index 7808d37deb..4aa0cbef50 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_dumper.rb @@ -1,7 +1,7 @@ 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 diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb index c027fef83c..2dca0b0f9c 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb @@ -1,7 +1,7 @@ module ActiveRecord module ConnectionAdapters module SQLite3 - module ColumnDumper + module ColumnDumper # :nodoc: private def default_primary_key?(column) diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 2fda4d60b8..de16ecf442 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -1138,4 +1138,8 @@ class CopyMigrationsTest < ActiveRecord::TestCase 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 |