diff options
author | Matthew Draper <matthew@trebex.net> | 2017-04-12 22:39:15 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2017-04-12 23:38:57 +0930 |
commit | 7384771dd0652ec4d82c0ad16522a87102316aee (patch) | |
tree | bf2fbbe92b154f4cca7a2a70abd6eb2d6d496e5e /activerecord/test/schema | |
parent | 2b4583f2a2ef94bc8c046e36e2b62ec642bbfb41 (diff) | |
download | rails-7384771dd0652ec4d82c0ad16522a87102316aee.tar.gz rails-7384771dd0652ec4d82c0ad16522a87102316aee.tar.bz2 rails-7384771dd0652ec4d82c0ad16522a87102316aee.zip |
Use a query that's compatible with PostgreSQL 9.2
Also, explicitly apply the order: generate_subscripts is unlikely to
start returning values out of order, but we should still be clear about
what we want.
Diffstat (limited to 'activerecord/test/schema')
-rw-r--r-- | activerecord/test/schema/postgresql_specific_schema.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/test/schema/postgresql_specific_schema.rb b/activerecord/test/schema/postgresql_specific_schema.rb index 860c63b27c..e56e8fa36a 100644 --- a/activerecord/test/schema/postgresql_specific_schema.rb +++ b/activerecord/test/schema/postgresql_specific_schema.rb @@ -3,11 +3,13 @@ ActiveRecord::Schema.define do enable_extension!("uuid-ossp", ActiveRecord::Base.connection) enable_extension!("pgcrypto", ActiveRecord::Base.connection) if ActiveRecord::Base.connection.supports_pgcrypto_uuid? - create_table :uuid_parents, id: :uuid, force: true do |t| + uuid_default = connection.supports_pgcrypto_uuid? ? {} : { default: "uuid_generate_v4()" } + + create_table :uuid_parents, id: :uuid, force: true, **uuid_default do |t| t.string :name end - create_table :uuid_children, id: :uuid, force: true do |t| + create_table :uuid_children, id: :uuid, force: true, **uuid_default do |t| t.string :name t.uuid :uuid_parent_id end @@ -102,7 +104,7 @@ _SQL end create_table :uuid_items, force: true, id: false do |t| - t.uuid :uuid, primary_key: true + t.uuid :uuid, primary_key: true, **uuid_default t.string :title end end |