Skip to content
This repository was archived by the owner on Sep 24, 2019. It is now read-only.

Commit 3c1b4d5

Browse files
committed
Add username to users table
1 parent bc44dff commit 3c1b4d5

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class AddUsernameToUsers < ActiveRecord::Migration[5.0]
2+
def change
3+
change_table :users do |t|
4+
t.string :username
5+
end
6+
add_index :users, :username, unique: true
7+
end
8+
end

db/schema.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 20170212195638) do
13+
ActiveRecord::Schema.define(version: 20170212223839) do
1414

1515
create_table "films", force: :cascade do |t|
1616
t.string "title"
@@ -153,6 +153,8 @@
153153
t.string "password_digest"
154154
t.datetime "created_at", null: false
155155
t.datetime "updated_at", null: false
156+
t.string "username"
157+
t.index ["username"], name: "index_users_on_username", unique: true
156158
end
157159

158160
create_table "vehicles", force: :cascade do |t|

test/fixtures/users.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
test-user:
2-
name: xuorig
1+
xuorig:
2+
name: Marc-André Giroux
3+
username: xuorig
34
password_digest: <%= BCrypt::Password.create('averysecurepassword', cost: BCrypt::Engine.cost) %>

0 commit comments

Comments
 (0)