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/cases/adapters/postgresql | |
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/cases/adapters/postgresql')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/uuid_test.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/uuid_test.rb b/activerecord/test/cases/adapters/postgresql/uuid_test.rb index 6aa6a79705..52e4a38cae 100644 --- a/activerecord/test/cases/adapters/postgresql/uuid_test.rb +++ b/activerecord/test/cases/adapters/postgresql/uuid_test.rb @@ -13,6 +13,10 @@ module PostgresqlUUIDHelper def uuid_function connection.supports_pgcrypto_uuid? ? "gen_random_uuid()" : "uuid_generate_v4()" end + + def uuid_default + connection.supports_pgcrypto_uuid? ? {} : { default: uuid_function } + end end class PostgresqlUUIDTest < ActiveRecord::PostgreSQLTestCase @@ -178,7 +182,7 @@ class PostgresqlUUIDGenerationTest < ActiveRecord::PostgreSQLTestCase t.uuid "other_uuid_2", default: "my_uuid_generator()" end - connection.create_table("pg_uuids_3", id: :uuid) do |t| + connection.create_table("pg_uuids_3", id: :uuid, **uuid_default) do |t| t.string "name" end end @@ -320,10 +324,10 @@ class PostgresqlUUIDTestInverseOf < ActiveRecord::PostgreSQLTestCase setup do connection.transaction do - connection.create_table("pg_uuid_posts", id: :uuid) do |t| + connection.create_table("pg_uuid_posts", id: :uuid, **uuid_default) do |t| t.string "title" end - connection.create_table("pg_uuid_comments", id: :uuid) do |t| + connection.create_table("pg_uuid_comments", id: :uuid, **uuid_default) do |t| t.references :uuid_post, type: :uuid t.string "content" end |