Enable Sinatra ActiveRecord UUIDs

Ensure that you have the ActiveRecord gem installed.

Create an initial migration to add UUID support.

bundle exec rake db:create_migration name=enable_uuid

Open the generated migration and add the following:

class EnableUuid < ActiveRecord::Migration[5.2]
  def change
    enable_extension 'pgcrypto'
  end
end

Run bundle exec rake db:migrate.

Finally, when creating new models add the id: :uuid argument to the create_tables method.

class CreateNewModel < ActiveRecord::Migration[5.2]
  def change
    create_table :new_model, id: :uuid do 
    end 
  end
end