# Use uuid on rails with PostgreSQL This guide is a sort of extract of official rails guide: [Official rails guide](http://edgeguides.rubyonrails.org/active_record_postgresql.html) Here I describe an implementation of uuid with PostgreSQL >= 9.4. This requires to enable `pgcrypto` Example with a creation of a table named trackers: ```rb class CreateTrackers < ActiveRecord::Migration[5.0] def change enable_extension 'pgcrypto' unless extension_enabled?('pgcrypto') create_table :trackers, id: :uuid, default: 'gen_random_uuid()' do |t| t.integer :duration, null: false t.string :description, null: false t.timestamps end end end ``` You can use uuid to degine a relation reference