aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/uuid_test.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2017-04-13 01:51:52 +0930
committerGitHub <noreply@github.com>2017-04-13 01:51:52 +0930
commit0eb21874cb89dc5ca42945111b4e4ae94106b3e5 (patch)
treebf2fbbe92b154f4cca7a2a70abd6eb2d6d496e5e /activerecord/test/cases/adapters/postgresql/uuid_test.rb
parent2b4583f2a2ef94bc8c046e36e2b62ec642bbfb41 (diff)
parent7384771dd0652ec4d82c0ad16522a87102316aee (diff)
downloadrails-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/cases/adapters/postgresql/uuid_test.rb')
-rw-r--r--activerecord/test/cases/adapters/postgresql/uuid_test.rb10
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