summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20140301210808_add_index_to_users_email.rb8
-rw-r--r--db/migrate/20140301211316_add_index_to_users_user_name.rb7
-rw-r--r--db/migrate/20140301213814_add_password_digest_to_users.rb5
-rw-r--r--db/migrate/20140302210209_add_remember_token_to_users.rb8
-rw-r--r--db/seeds.rb4
5 files changed, 32 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/20140301213814_add_password_digest_to_users.rb b/db/migrate/20140301213814_add_password_digest_to_users.rb
new file mode 100644
index 0000000..7ad1f62
--- /dev/null
+++ b/db/migrate/20140301213814_add_password_digest_to_users.rb
@@ -0,0 +1,5 @@
+class AddPasswordDigestToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :password_digest, :string
+ end
+end
diff --git a/db/migrate/20140302210209_add_remember_token_to_users.rb b/db/migrate/20140302210209_add_remember_token_to_users.rb
new file mode 100644
index 0000000..6d84942
--- /dev/null
+++ b/db/migrate/20140302210209_add_remember_token_to_users.rb
@@ -0,0 +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)
+
+