Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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'
gem 'ar-uuid'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.