diff options
author | Matthew Draper <matthew@trebex.net> | 2017-04-13 01:51:52 +0930 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-13 01:51:52 +0930 |
commit | 0eb21874cb89dc5ca42945111b4e4ae94106b3e5 (patch) | |
tree | bf2fbbe92b154f4cca7a2a70abd6eb2d6d496e5e /activerecord/test/schema/postgresql_specific_schema.rb | |
parent | 2b4583f2a2ef94bc8c046e36e2b62ec642bbfb41 (diff) | |
parent | 7384771dd0652ec4d82c0ad16522a87102316aee (diff) | |
download | rails-0eb21874cb89dc5ca42945111b4e4ae94106b3e5.tar.gz rails-0eb21874cb89dc5ca42945111b4e4ae94106b3e5.tar.bz2 rails-0eb21874cb89dc5ca42945111b4e4ae94106b3e5.zip |
Merge pull request #28740 from matthewd/old-postgres
Use a query that's compatible with PostgreSQL 9.2
Diffstat (limited to 'activerecord/test/schema/postgresql_specific_schema.rb')
-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 |