summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorMrYummy <elemental428@gmail.com>2017-05-28 17:39:06 -0400
committerMrYummy <elemental428@gmail.com>2017-06-18 13:11:36 -0400
commit1b4a270038cb5055be79269fff07fab92a6c5d92 (patch)
tree09f496b117f3eaa896be6fac90bdb2fb19522307 /db
parent992406a20b90d47d1ef8a9b4f8d0c599590a1171 (diff)
Added badge system
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20170319193517_add_badge_id_to_users.rb8
-rw-r--r--db/schema.rb10
-rw-r--r--db/seeds.rb55
3 files changed, 69 insertions, 4 deletions
diff --git a/db/migrate/20170319193517_add_badge_id_to_users.rb b/db/migrate/20170319193517_add_badge_id_to_users.rb
new file mode 100644
index 0000000..08328cf
--- /dev/null
+++ b/db/migrate/20170319193517_add_badge_id_to_users.rb
@@ -0,0 +1,8 @@
+class AddBadgeIdToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :badge_id, :integer
+ add_column :users, :badge_id, :integer, default: 0
+ User.where(donor: true).update_all(badge_id: 1)
+ remove_column :users, :donor
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 2c68029..b38ae38 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20160926220738) do
+ActiveRecord::Schema.define(version: 20170319193517) do
create_table "blogposts", force: :cascade do |t|
t.string "title"
@@ -90,6 +90,12 @@ ActiveRecord::Schema.define(version: 20160926220738) do
t.string "color"
end
+ create_table "badges", force: :cascade do |t|
+ t.string "name"
+ t.string "symbol"
+ t.string "color"
+ end
+
create_table "sessions", force: :cascade do |t|
t.string "session_id", null: false
t.text "data", limit: 65535
@@ -122,7 +128,6 @@ ActiveRecord::Schema.define(version: 20160926220738) do
t.string "youtube"
t.string "youtube_channelname"
t.string "twitter"
- t.boolean "donor", default: false
t.string "email_token"
t.boolean "confirmed", default: false
t.datetime "last_seen"
@@ -134,6 +139,7 @@ ActiveRecord::Schema.define(version: 20160926220738) do
t.boolean "mail_own_blogpost_comment", default: true
t.boolean "mail_other_blogpost_comment", default: true
t.boolean "mail_mention", default: true
+ t.integer "badge_id"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
diff --git a/db/seeds.rb b/db/seeds.rb
index 780ddb5..06c8d10 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -10,6 +10,14 @@ Role.create!([
{name: "superadmin", value: 500, color: "#d22"}
])
+Badge.create!([
+ {name: "none", symbol: "", color: "#000"},
+ {name: "donor", symbol: "$", color: "#f60"},
+ {name: "developer", symbol: "D", color: "#a0a"},
+ {name: "retired", symbol: "R", color: "#0aa"},
+ {name: "lead", symbol: "L", color: "#a00"}
+])
+
userpw = SecureRandom.hex(36)
@@ -23,6 +31,7 @@ deleted_user = User.create!(
password: userpw,
password_confirmation: userpw,
role: Role.get(:disabled),
+ badge: Badge.get(:none),
skype: "echo123",
skype_public: true,
last_ip: "0.0.0.0",
@@ -37,5 +46,47 @@ User.create!(
email: "jomo@example.com",
password: "123456789", # high seructity!
password_confirmation: "123456789",
- role: Role.get(:superadmin)
-) \ No newline at end of file
+ role: Role.get(:superadmin),
+ badge: Badge.get(:donor),
+ confirmed: true
+)
+User.create!(
+ uuid: "7f52491ab5d64c11b4a43806db47a101",
+ ign: "YummyRedstone",
+ email: "yummy@example.com",
+ password: "123456789", # high seructity!
+ password_confirmation: "123456789",
+ role: Role.get(:admin),
+ badge: Badge.get(:lead),
+ confirmed: true
+)
+User.create!(
+ uuid: "d2693e9193e14e3f929ff38e1ce8df03",
+ ign: "Pepich1851",
+ email: "pepe@example.com",
+ password: "123456789", # high seructity!
+ password_confirmation: "123456789",
+ role: Role.get(:superadmin),
+ badge: Badge.get(:retired),
+ confirmed: true
+)
+User.create!(
+ uuid: "c69f8316c60a4f8ca922bda933e01acd",
+ ign: "Doomblah",
+ email: "doom@example.com",
+ password: "123456789", # high seructity!
+ password_confirmation: "123456789",
+ role: Role.get(:normal),
+ badge: Badge.get(:developer),
+ confirmed: true
+)
+User.create!(
+ uuid: "b85a91b558b0474da2a42d5dd025f9e5",
+ ign: "Futsy",
+ email: "futsy@example.com",
+ password: "123456789", # high seructity!
+ password_confirmation: "123456789",
+ role: Role.get(:mod),
+ badge: Badge.get(:none),
+ confirmed: true
+)