diff options
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 |
