diff options
author | jomo <github@jomo.tv> | 2014-04-04 01:08:17 +0200 |
---|---|---|
committer | jomo <github@jomo.tv> | 2014-04-04 01:08:17 +0200 |
commit | f290258f26f998bf79c24f2c44577bdae5d5f7c0 (patch) | |
tree | 0530c35c89e2ba46dbaf81dd52f1575e419a72b0 /db | |
parent | 0604bbce63211654fe66f5cae77d8f9ee74a875c (diff) |
LOTS of stuff
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/00000000000002_create_users.rb | 23 | ||||
-rw-r--r-- | db/migrate/01_create_roles.rb (renamed from db/migrate/00000000000001_create_roles.rb) | 7 | ||||
-rw-r--r-- | db/migrate/02_create_users.rb | 26 | ||||
-rw-r--r-- | db/migrate/03_create_blogposts.rb (renamed from db/migrate/00000000000003_create_blogposts.rb) | 4 | ||||
-rw-r--r-- | db/migrate/04_create_comments.rb (renamed from db/migrate/00000000000004_create_comments.rb) | 2 | ||||
-rw-r--r-- | db/migrate/05_create_forumgroups.rb (renamed from db/migrate/00000000000005_create_forumgroups.rb) | 4 | ||||
-rw-r--r-- | db/migrate/06_create_forums.rb (renamed from db/migrate/00000000000006_create_forums.rb) | 4 | ||||
-rw-r--r-- | db/migrate/07_create_forumthreads.rb (renamed from db/migrate/00000000000007_create_forumthreads.rb) | 0 | ||||
-rw-r--r-- | db/migrate/08_create_sessions.rb (renamed from db/migrate/00000000000008_add_sessions_table.rb) | 2 | ||||
-rw-r--r-- | db/migrate/09_create_register_tokens.rb | 10 | ||||
-rw-r--r-- | db/migrate/10_create_threadreplies.rb | 13 | ||||
-rw-r--r-- | db/schema.rb | 22 | ||||
-rw-r--r-- | db/seeds.rb | 27 |
13 files changed, 91 insertions, 53 deletions
diff --git a/db/migrate/00000000000002_create_users.rb b/db/migrate/00000000000002_create_users.rb deleted file mode 100644 index 1da43af..0000000 --- a/db/migrate/00000000000002_create_users.rb +++ /dev/null @@ -1,23 +0,0 @@ -class CreateUsers < ActiveRecord::Migration - def change - create_table :users do |t| - t.string :name, :unique => true, :null => false - t.string :password_digest, :null => false - t.string :ign, :unique => true, :null => false - t.string :email, :unique => true, :null => false - t.string :confirm_code, :null => false - t.text :about - t.string :last_ip - t.string :skype, :unique => true - t.boolean :skype_public, :default => false - t.string :youtube, :unique => true - t.string :youtube_channelname - t.string :twitter, :unique => true - t.datetime :last_login - - t.references :role, :null => false - - t.timestamps - end - end -end
\ No newline at end of file diff --git a/db/migrate/00000000000001_create_roles.rb b/db/migrate/01_create_roles.rb index 8fb2b08..3a25ea7 100644 --- a/db/migrate/00000000000001_create_roles.rb +++ b/db/migrate/01_create_roles.rb @@ -1,11 +1,8 @@ class CreateRoles < ActiveRecord::Migration - def up + def change create_table :roles do |t| t.string :name t.integer :value end end - - def down - end -end +end
\ No newline at end of file diff --git a/db/migrate/02_create_users.rb b/db/migrate/02_create_users.rb new file mode 100644 index 0000000..bb1a012 --- /dev/null +++ b/db/migrate/02_create_users.rb @@ -0,0 +1,26 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.string :uuid, unique: true, null: false + t.string :name, unique: true, null: false + t.string :password_digest, null: false + t.string :ign, unique: true, null: false + t.string :email, unique: true, null: false + t.text :about + t.string :last_ip + t.string :skype, unique: true + t.boolean :skype_public, default: false + t.string :youtube, unique: true + t.string :youtube_channelname + t.string :twitter, unique: true + t.boolean :donor, default: false + t.string :email_token + t.boolean :confirmed, default: false + t.datetime :last_seen + + t.references :role, null: false + + t.timestamps + end + end +end
\ No newline at end of file diff --git a/db/migrate/00000000000003_create_blogposts.rb b/db/migrate/03_create_blogposts.rb index b8d5c7e..fd674bb 100644 --- a/db/migrate/00000000000003_create_blogposts.rb +++ b/db/migrate/03_create_blogposts.rb @@ -1,8 +1,8 @@ class CreateBlogposts < ActiveRecord::Migration def change create_table :blogposts do |t| - t.string :title - t.text :content + t.string :title + t.text :content t.references :user_author t.references :user_editor diff --git a/db/migrate/00000000000004_create_comments.rb b/db/migrate/04_create_comments.rb index 70a2988..61b6871 100644 --- a/db/migrate/00000000000004_create_comments.rb +++ b/db/migrate/04_create_comments.rb @@ -1,7 +1,7 @@ class CreateComments < ActiveRecord::Migration def change create_table :comments do |t| - t.text :content + t.text :content t.references :user_author t.references :user_editor diff --git a/db/migrate/00000000000005_create_forumgroups.rb b/db/migrate/05_create_forumgroups.rb index 4c06033..a31dbb5 100644 --- a/db/migrate/00000000000005_create_forumgroups.rb +++ b/db/migrate/05_create_forumgroups.rb @@ -1,8 +1,8 @@ class CreateForumgroups < ActiveRecord::Migration def change create_table :forumgroups do |t| - t.string :name - t.integer :position + t.string :name + t.integer :position t.references :role_read t.references :role_write diff --git a/db/migrate/00000000000006_create_forums.rb b/db/migrate/06_create_forums.rb index 61a7141..99ad8c6 100644 --- a/db/migrate/00000000000006_create_forums.rb +++ b/db/migrate/06_create_forums.rb @@ -1,8 +1,8 @@ class CreateForums < ActiveRecord::Migration def change create_table :forums do |t| - t.string :name - t.integer :position + t.string :name + t.integer :position t.references :role_read t.references :role_write diff --git a/db/migrate/00000000000007_create_forumthreads.rb b/db/migrate/07_create_forumthreads.rb index 1f06761..1f06761 100644 --- a/db/migrate/00000000000007_create_forumthreads.rb +++ b/db/migrate/07_create_forumthreads.rb diff --git a/db/migrate/00000000000008_add_sessions_table.rb b/db/migrate/08_create_sessions.rb index 4c87956..b2443e4 100644 --- a/db/migrate/00000000000008_add_sessions_table.rb +++ b/db/migrate/08_create_sessions.rb @@ -1,4 +1,4 @@ -class AddSessionsTable < ActiveRecord::Migration +class CreateSessions < ActiveRecord::Migration def change create_table :sessions do |t| t.string :session_id, :null => false diff --git a/db/migrate/09_create_register_tokens.rb b/db/migrate/09_create_register_tokens.rb new file mode 100644 index 0000000..d103ee6 --- /dev/null +++ b/db/migrate/09_create_register_tokens.rb @@ -0,0 +1,10 @@ +class CreateRegisterTokens < ActiveRecord::Migration + def change + create_table :register_tokens, primary_key: :uuid do |t| + t.string :uuid, limit: 32, unique: true, primary: true, null: false + t.string :token, limit: 6, null: false + t.string :email, unique: true, null: false + end + change_column :register_tokens, :uuid, :string + end +end
\ No newline at end of file diff --git a/db/migrate/10_create_threadreplies.rb b/db/migrate/10_create_threadreplies.rb new file mode 100644 index 0000000..97a6626 --- /dev/null +++ b/db/migrate/10_create_threadreplies.rb @@ -0,0 +1,13 @@ +class CreateThreadreplies < ActiveRecord::Migration + def change + create_table :threadreplies do |t| + t.text :content + + t.references :user_author + t.references :user_editor + t.references :forumthread + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index add6f97..cfb8d63 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 8) do +ActiveRecord::Schema.define(:version => 10) do create_table "blogposts", :force => true do |t| t.string "title" @@ -58,6 +58,10 @@ ActiveRecord::Schema.define(:version => 8) do t.datetime "updated_at", :null => false end + create_table "register_tokens", :primary_key => "uuid", :force => true do |t| + t.string "token", :limit => 6, :null => false + end + create_table "roles", :force => true do |t| t.string "name" t.integer "value" @@ -73,12 +77,21 @@ ActiveRecord::Schema.define(:version => 8) do add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id" add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at" + create_table "threadreplies", :force => true do |t| + t.text "content" + t.integer "user_author_id" + t.integer "user_editor_id" + t.integer "forumthread_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "users", :force => true do |t| + t.string "uuid", :null => false t.string "name", :null => false t.string "password_digest", :null => false t.string "ign", :null => false t.string "email", :null => false - t.string "confirm_code", :null => false t.text "about" t.string "last_ip" t.string "skype" @@ -86,7 +99,10 @@ ActiveRecord::Schema.define(:version => 8) do t.string "youtube" t.string "youtube_channelname" t.string "twitter" - t.datetime "last_login" + t.boolean "donor", :default => false + t.string "email_token" + t.boolean "confirmed", :default => false + t.datetime "last_seen" t.integer "role_id", :null => false t.datetime "created_at", :null => false t.datetime "updated_at", :null => false diff --git a/db/seeds.rb b/db/seeds.rb index 283d666..40d358b 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -4,9 +4,7 @@ Role.create!([ {name: "disabled", value: 1}, {name: "banned", value: 2}, - {name: "unconfirmed", value: 5}, - {name: "default", value: 10}, - {name: "donor", value: 40}, + {name: "normal", value: 10}, {name: "mod", value: 100}, {name: "admin", value: 200}, {name: "superadmin", value: 500} @@ -14,29 +12,30 @@ Role.create!([ userpw = SecureRandom.hex(64) + +# fallback profile for deleted users deleted_user = User.create!( + uuid: "8667ba71b85a4004af54457a9734eed7", name: "Deleted user", email: "redstonerserver@gmail.com", - ign: "Mojang", + ign: "Steve", about: "Hey, apparently, I do no longer exist. This is just a placeholder profile", password: userpw, password_confirmation: userpw, role: Role.get(:disabled), - confirm_code: SecureRandom.hex(16), skype: "echo123", skype_public: true, last_ip: "0.0.0.0", - last_login: Time.utc(0).to_datetime - ) - deleted_user.update_attribute(:ign, "Steve") + confirmed: true, + last_seen: Time.utc(0).to_datetime +) +deleted_user.update_attribute(:ign, "Steve") User.create!( - name: "Redstone Sheep", + uuid: "9ff3d74f716940a3aa6f262ab632d2", ign: "redstone_sheep", email: "theredstonesheep@gmail.com", - about: "Hi, I am the admin :)", - password: "123456789", + password: "123456789", # high seructity! password_confirmation: "123456789", - role: Role.get(:superadmin), - confirm_code: SecureRandom.hex(16) - )
\ No newline at end of file + role: Role.get(:superadmin) +)
\ No newline at end of file |