diff options
Diffstat (limited to 'db/migrate')
4 files changed, 12 insertions, 0 deletions
diff --git a/db/migrate/20140304043652_add_index_to_users_email.rb b/db/migrate/20140304043652_add_index_to_users_email.rb index b5f8a1a..934d23b 100644 --- a/db/migrate/20140304043652_add_index_to_users_email.rb +++ b/db/migrate/20140304043652_add_index_to_users_email.rb @@ -1,4 +1,8 @@ class AddIndexToUsersEmail < ActiveRecord::Migration + +# adding unique: true ensures there can be no duplicates def change + add_index :users, :email, unique: true end + end diff --git a/db/migrate/20140304043654_add_index_to_users_user_name.rb b/db/migrate/20140304043654_add_index_to_users_user_name.rb index 724cca5..22ca8c3 100644 --- a/db/migrate/20140304043654_add_index_to_users_user_name.rb +++ b/db/migrate/20140304043654_add_index_to_users_user_name.rb @@ -1,4 +1,7 @@ class AddIndexToUsersUserName < ActiveRecord::Migration + +# ensures that the username is unique def change + add_index :users, :user_name, unique: true end end diff --git a/db/migrate/20140304043656_add_password_digest_to_users.rb b/db/migrate/20140304043656_add_password_digest_to_users.rb index 0070da7..7ad1f62 100644 --- a/db/migrate/20140304043656_add_password_digest_to_users.rb +++ b/db/migrate/20140304043656_add_password_digest_to_users.rb @@ -1,4 +1,5 @@ class AddPasswordDigestToUsers < ActiveRecord::Migration def change + add_column :users, :password_digest, :string end end diff --git a/db/migrate/20140304043658_add_remember_token_to_users.rb b/db/migrate/20140304043658_add_remember_token_to_users.rb index 74c254f..6d84942 100644 --- a/db/migrate/20140304043658_add_remember_token_to_users.rb +++ b/db/migrate/20140304043658_add_remember_token_to_users.rb @@ -1,4 +1,8 @@ class AddRememberTokenToUsers < ActiveRecord::Migration + #add a remember me token to the database + #this keeps a user signed in until they sign out def change + add_column :users, :remember_token, :string + add_index :users, :remember_token end end |