Skip to content

Instantly share code, notes, and snippets.

@warmwaffles
Last active January 2, 2016 00:49
Show Gist options
  • Save warmwaffles/8226206 to your computer and use it in GitHub Desktop.
Save warmwaffles/8226206 to your computer and use it in GitHub Desktop.
class EnableUuid < ActiveRecord::Migration
def change
enable_extension 'uuid-ossp'
end
end
class CreateUsers < ActiveRecord::Migration
def change
create_table :users, id: :uuid do |t|
t.string :name
t.string :email, :null => false
t.string :encrypted_password, :null => false
t.string :salt, :null => false
t.string :reset_password_token, :default => nil
t.datetime :reset_password_token_expires_at, :default => nil
t.datetime :reset_password_email_sent_at, :default => nil
t.integer :failed_logins_count, :default => 0
t.datetime :lock_expires_at, :default => nil
t.string :unlock_token, :default => nil
t.timestamps
end
add_index :users, :email, unique: true
add_index :users, :reset_password_token
end
end
ActiveRecord::Schema.define(version: 02) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
enable_extension "uuid-ossp"
create_table "users", id: :uuid, default: "uuid_generate_v4()", force: true do |t|
t.string "name"
t.string "email", null: false
t.string "crypted_password", null: false
t.string "salt", null: false
t.string "reset_password_token"
t.datetime "reset_password_token_expires_at"
t.datetime "reset_password_email_sent_at"
t.integer "failed_logins_count", default: 0
t.datetime "lock_expires_at"
t.string "unlock_token"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", using: :btree
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment