diff options
| author | mo khan <mo@mokhan.ca> | 2015-02-21 12:36:27 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2015-02-21 12:36:27 -0700 |
| commit | df3daf73da872a6872582fa925ffae29f6fdca6b (patch) | |
| tree | 402b52221f35d7176b996c31ebc5956bb3d39da8 /db | |
| parent | 6ada62adfd2b60e3af4f721ed8e09a5658920fa6 (diff) | |
fix users table schema.
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrate/20150221192553_create_users.rb | 8 | ||||
| -rw-r--r-- | db/schema.rb | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/db/migrate/20150221192553_create_users.rb b/db/migrate/20150221192553_create_users.rb index 72a9f38..f1a7146 100644 --- a/db/migrate/20150221192553_create_users.rb +++ b/db/migrate/20150221192553_create_users.rb @@ -1,10 +1,12 @@ class CreateUsers < ActiveRecord::Migration def change - create_table :users do |t| - t.string :username - t.string :password_digest + create_table :users, id: :uuid, default: 'uuid_generate_v4()' do |t| + t.string :username, null: false + t.string :password_digest, null: false t.timestamps null: false end + + add_index :users, :username, unique: true end end diff --git a/db/schema.rb b/db/schema.rb index d7219a5..45aa6ea 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -47,11 +47,13 @@ ActiveRecord::Schema.define(version: 20150221192553) do t.datetime "updated_at", null: false end - create_table "users", force: :cascade do |t| - t.string "username" - t.string "password_digest" + create_table "users", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t| + t.string "username", null: false + t.string "password_digest", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false end + add_index "users", ["username"], name: "index_users_on_username", unique: true, using: :btree + end |
