aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/schema
diff options
context:
space:
mode:
authorYaw Boakye <wheresyaw@gmail.com>2016-07-08 03:22:37 +0000
committerYaw Boakye <wheresyaw@gmail.com>2016-11-22 22:11:18 +0000
commitb915b11cca558eb99b7c2621c4457491d4bdb43b (patch)
tree647d9ff0be8cce2d56efa5e589e2e28a5bcd9808 /activerecord/test/schema
parent49aa974ec8b15721d53b3b6abea88bd6ba433a68 (diff)
downloadrails-b915b11cca558eb99b7c2621c4457491d4bdb43b.tar.gz
rails-b915b11cca558eb99b7c2621c4457491d4bdb43b.tar.bz2
rails-b915b11cca558eb99b7c2621c4457491d4bdb43b.zip
For `PostgreSQL >= 9.4` use `gen_random_uuid()`
Since 9.4, PostgreSQL recommends using `pgcrypto`'s `gen_random_uuid()` to generate version 4 UUIDs instead of the functions in the `uuid-ossp` extension. These changes uses the appropriate UUID function depending on the underlying PostgreSQL server's version, while maintaining `uuid_generate_v4()` in older migrations.
Diffstat (limited to 'activerecord/test/schema')
-rw-r--r--activerecord/test/schema/postgresql_specific_schema.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/test/schema/postgresql_specific_schema.rb b/activerecord/test/schema/postgresql_specific_schema.rb
index f00b858ea6..15ba2d67ab 100644
--- a/activerecord/test/schema/postgresql_specific_schema.rb
+++ b/activerecord/test/schema/postgresql_specific_schema.rb
@@ -1,6 +1,7 @@
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|
t.string :name