aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorGuilherme Goettems Schneider <guigs81@gmail.com>2019-06-03 08:05:36 -0300
committerGuilherme Goettems Schneider <guigs81@gmail.com>2019-06-03 08:35:36 -0300
commit49f31043be571381fd66dbc22b123d5625af64de (patch)
treeaeecb67c6d1360597fa5192abb35ec30293f1e18 /activerecord/lib
parent5f2bc3a6a00a2277481de7241f7a2066e886b84d (diff)
downloadrails-49f31043be571381fd66dbc22b123d5625af64de.tar.gz
rails-49f31043be571381fd66dbc22b123d5625af64de.tar.bz2
rails-49f31043be571381fd66dbc22b123d5625af64de.zip
Fix invalid schema dump when primary key column has a comment
Before this fix it would either generate an invalid schema, passing `comment` option twice to `create_table`, or it move the comment from primary key column to the table if table had no comment when the dump was generated. The situation now is that a comment on primary key will be ignored (not present on schema). Fixes #29966
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb2
1 files changed, 1 insertions, 1 deletions
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 622e00fffb..fb56e712be 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb
@@ -15,7 +15,7 @@ module ActiveRecord
def column_spec_for_primary_key(column)
return {} if default_primary_key?(column)
spec = { id: schema_type(column).inspect }
- spec.merge!(prepare_column_options(column).except!(:null))
+ spec.merge!(prepare_column_options(column).except!(:null, :comment))
spec[:default] ||= "nil" if explicit_primary_key_default?(column)
spec
end