aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/schema_dumper.rb
diff options
context:
space:
mode:
authorBrian Buchanan <brian@tiogalake.com>2013-05-03 16:05:55 -0700
committerBrian Buchanan <brian@tiogalake.com>2013-05-03 16:05:55 -0700
commitfa87e3166fd404f9d494965fb20712a55af078fb (patch)
tree9205cdedfa7c723c529dfb831b6fcba80587b5bd /activerecord/lib/active_record/schema_dumper.rb
parent9a4268db99d93190c58bddcb150832727a0d5129 (diff)
downloadrails-fa87e3166fd404f9d494965fb20712a55af078fb.tar.gz
rails-fa87e3166fd404f9d494965fb20712a55af078fb.tar.bz2
rails-fa87e3166fd404f9d494965fb20712a55af078fb.zip
Make SchemaDumper emit "id: :uuid" when appropriate. Fixes #10451.
Diffstat (limited to 'activerecord/lib/active_record/schema_dumper.rb')
-rw-r--r--activerecord/lib/active_record/schema_dumper.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb
index 10c6d272cd..1181cc739e 100644
--- a/activerecord/lib/active_record/schema_dumper.rb
+++ b/activerecord/lib/active_record/schema_dumper.rb
@@ -106,9 +106,12 @@ HEADER
end
tbl.print " create_table #{remove_prefix_and_suffix(table).inspect}"
- if columns.detect { |c| c.name == pk }
+ pkcol = columns.detect { |c| c.name == pk }
+ if pkcol
if pk != 'id'
tbl.print %Q(, primary_key: "#{pk}")
+ elsif pkcol.sql_type == 'uuid'
+ tbl.print ", id: :uuid"
end
else
tbl.print ", id: false"