diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-11-25 10:26:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-25 10:26:39 +0100 |
commit | 43e0aee8ccae5bf55e0a63c89c9a322752ea6e05 (patch) | |
tree | 991976a54d89ec43e52d09550f87ce0d5d5df577 | |
parent | f243e7f0d0b2cef350127fd518532fedb65f0bd0 (diff) | |
parent | 312b345b45cc6cbbd832c789ac14f261da66c80f (diff) | |
download | rails-43e0aee8ccae5bf55e0a63c89c9a322752ea6e05.tar.gz rails-43e0aee8ccae5bf55e0a63c89c9a322752ea6e05.tar.bz2 rails-43e0aee8ccae5bf55e0a63c89c9a322752ea6e05.zip |
Merge pull request #27165 from prathamesh-sonpatki/followup-uuid-extension-change
Followup of UUID default extension in the docs
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb | 20 | ||||
-rw-r--r-- | guides/source/active_record_postgresql.md | 2 |
2 files changed, 16 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb index 5d689c2dc3..ae1ec3e2b7 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb @@ -12,11 +12,21 @@ module ActiveRecord # end # # By default, this will use the +gen_random_uuid()+ function from the - # +pgcrypto+ extension (only PostgreSQL >= 9.4), or +uuid_generate_v4()+ - # function from the +uuid-ossp+ extension. To enable the appropriate - # extension, which is a requirement, you can use the +enable_extension+ - # method in your migrations. To use a UUID primary key without any of - # of extensions, you can set the +:default+ option to +nil+: + # +pgcrypto+ extension. As that extension is only available in + # PostgreSQL 9.4+, for earlier versions an explicit default can be set + # to use +uuid_generate_v4()+ from the +uuid-ossp+ extension instead: + # + # create_table :stuffs, id: false do |t| + # t.primary_key :id, :uuid, default: "uuid_generate_v4()" + # t.uuid :foo_id + # t.timestamps + # end + # + # To enable the appropriate extension, which is a requirement, use + # the +enable_extension+ method in your migrations. + # + # To use a UUID primary key without any of the extensions, set the + # +:default+ option to +nil+: # # create_table :stuffs, id: false do |t| # t.primary_key :id, :uuid, default: nil diff --git a/guides/source/active_record_postgresql.md b/guides/source/active_record_postgresql.md index d7e35490ef..58af2f82b3 100644 --- a/guides/source/active_record_postgresql.md +++ b/guides/source/active_record_postgresql.md @@ -422,7 +422,7 @@ device = Device.create device.id # => "814865cd-5a1d-4771-9306-4268f188fe9e" ``` -NOTE: `uuid_generate_v4()` (from `uuid-ossp`) is assumed if no `:default` option was +NOTE: `gen_random_uuid()` (from `pgcrypto`) is assumed if no `:default` option was passed to `create_table`. Full Text Search |