- No need to change migrations
- Problems with
first
andlast
, see: https://github.com/fnando/ar-uuid#disadvantages
Created
July 19, 2016 17:28
-
-
Save lopezjurip/e266abe09a1443e104cee79edf9bac87 to your computer and use it in GitHub Desktop.
Rails 5 w/ Postgres: Use UUID instead of a numeric ID as primary keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# db/migrate/00000000000000_enable_uuid.rb | |
class EnableUuid < ActiveRecord::Migration[5.0] | |
def change | |
execute 'create extension "uuid-ossp"' | |
enable_extension 'uuid-ossp' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'ar-uuid' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment