aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/schema_dumper.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-02 13:37:26 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-01-02 13:37:26 -0300
commita908e01ac0cfd5b1d9cda57699037df8aa32df25 (patch)
treeb2064b0448d01f1a8f306b17b77868390f33cec8 /activerecord/lib/active_record/schema_dumper.rb
parent78dab2a8569408658542e462a957ea5a35aa4679 (diff)
parent3628025c0dea3e08ea386700ec5eea27a26ce5d6 (diff)
downloadrails-a908e01ac0cfd5b1d9cda57699037df8aa32df25.tar.gz
rails-a908e01ac0cfd5b1d9cda57699037df8aa32df25.tar.bz2
rails-a908e01ac0cfd5b1d9cda57699037df8aa32df25.zip
Merge pull request #18228 from kamipo/correctly_dump_primary_key
Improve a dump of the primary key support. Conflicts: activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/lib/active_record/schema_dumper.rb')
-rw-r--r--activerecord/lib/active_record/schema_dumper.rb11
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"