Skip to content

Instantly share code, notes, and snippets.

@lopezjurip
Created July 19, 2016 17:28
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