Skip to content

Instantly share code, notes, and snippets.

@lopezjurip
Created July 19, 2016 17:28
Show Gist options
  • Save lopezjurip/e266abe09a1443e104cee79edf9bac87 to your computer and use it in GitHub Desktop.
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
# 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
gem 'ar-uuid'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment