summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20140304043652_add_index_to_users_email.rb4
-rw-r--r--db/migrate/20140304043654_add_index_to_users_user_name.rb3
-rw-r--r--db/migrate/20140304043656_add_password_digest_to_users.rb1
-rw-r--r--db/migrate/20140304043658_add_remember_token_to_users.rb4
-rw-r--r--db/seeds.rb4
5 files changed, 16 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
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)
+
+