diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20140301210808_add_index_to_users_email.rb | 8 | ||||
-rw-r--r-- | db/migrate/20140301211316_add_index_to_users_user_name.rb | 7 | ||||
-rw-r--r-- | db/migrate/20140304041716_add_password_digest_to_users.rb | 1 | ||||
-rw-r--r-- | db/migrate/20140304041718_add_remember_token_to_users.rb | 4 | ||||
-rw-r--r-- | db/seeds.rb | 4 |
5 files changed, 24 insertions, 0 deletions
diff --git a/db/migrate/20140301210808_add_index_to_users_email.rb b/db/migrate/20140301210808_add_index_to_users_email.rb new file mode 100644 index 0000000..934d23b --- /dev/null +++ b/db/migrate/20140301210808_add_index_to_users_email.rb @@ -0,0 +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/20140301211316_add_index_to_users_user_name.rb b/db/migrate/20140301211316_add_index_to_users_user_name.rb new file mode 100644 index 0000000..22ca8c3 --- /dev/null +++ b/db/migrate/20140301211316_add_index_to_users_user_name.rb @@ -0,0 +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/20140304041716_add_password_digest_to_users.rb b/db/migrate/20140304041716_add_password_digest_to_users.rb index 0070da7..7ad1f62 100644 --- a/db/migrate/20140304041716_add_password_digest_to_users.rb +++ b/db/migrate/20140304041716_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/20140304041718_add_remember_token_to_users.rb b/db/migrate/20140304041718_add_remember_token_to_users.rb index 74c254f..6d84942 100644 --- a/db/migrate/20140304041718_add_remember_token_to_users.rb +++ b/db/migrate/20140304041718_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 diff --git a/db/seeds.rb b/db/seeds.rb index 4edb1e8..ab130a8 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,3 +5,7 @@ # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) +# +Game.create(name: "League of Legends", players_per_team: 5, teams_per_match: 2, set_rounds: 1, randomized_teams: 0) + + |