diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2014-12-11 22:57:28 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2014-12-29 09:19:21 +0900 |
commit | 3628025c0dea3e08ea386700ec5eea27a26ce5d6 (patch) | |
tree | 933654027988dc4ec799597ad47eb1925487e237 /activerecord/lib/active_record/schema_dumper.rb | |
parent | 73fe108d700cc2fa85bc7775c5a2ca9ca529849a (diff) | |
download | rails-3628025c0dea3e08ea386700ec5eea27a26ce5d6.tar.gz rails-3628025c0dea3e08ea386700ec5eea27a26ce5d6.tar.bz2 rails-3628025c0dea3e08ea386700ec5eea27a26ce5d6.zip |
Improve a dump of the primary key support.
If it is not a default primary key, correctly dump the type and options.
Diffstat (limited to 'activerecord/lib/active_record/schema_dumper.rb')
-rw-r--r-- | activerecord/lib/active_record/schema_dumper.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index 2a570e1323..da95920571 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -117,11 +117,12 @@ HEADER if pkcol if pk != 'id' tbl.print %Q(, primary_key: "#{pk}") - elsif pkcol.sql_type == 'bigint' - tbl.print ", id: :bigserial" - elsif pkcol.sql_type == 'uuid' - tbl.print ", id: :uuid" - tbl.print %Q(, default: #{pkcol.default_function.inspect}) + end + pkcolspec = @connection.column_spec_for_primary_key(pkcol) + if pkcolspec + pkcolspec.each do |key, value| + tbl.print ", #{key}: #{value}" + end end else tbl.print ", id: false" |