another big commit :D
This commit is contained in:
11
db/migrate/00000000000001_create_roles.rb
Normal file
11
db/migrate/00000000000001_create_roles.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class CreateRoles < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :roles do |t|
|
||||
t.string :name
|
||||
t.integer :value
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
23
db/migrate/00000000000002_create_users.rb
Normal file
23
db/migrate/00000000000002_create_users.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
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
|
||||
@@ -2,10 +2,12 @@ class CreateBlogposts < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :blogposts do |t|
|
||||
t.string :title
|
||||
t.text :text
|
||||
t.references :user
|
||||
t.text :content
|
||||
|
||||
t.references :user_author
|
||||
t.references :user_editor
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,8 +1,10 @@
|
||||
class CreateComments < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :comments do |t|
|
||||
t.text :text
|
||||
t.integer :user_id
|
||||
t.text :content
|
||||
|
||||
t.references :user_author
|
||||
t.references :user_editor
|
||||
t.references :blogpost
|
||||
|
||||
t.timestamps
|
||||
10
db/migrate/00000000000005_create_forumgroups.rb
Normal file
10
db/migrate/00000000000005_create_forumgroups.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
class CreateForumgroups < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :forumgroups do |t|
|
||||
t.string :name
|
||||
t.integer :position
|
||||
t.integer :read_permission
|
||||
t.integer :write_permission
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,11 +1,12 @@
|
||||
class CreateForums < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :forums do |t|
|
||||
t.string "name"
|
||||
t.integer "position"
|
||||
t.references :forumgroup
|
||||
t.string :name
|
||||
t.integer :position
|
||||
t.integer :read_permission
|
||||
t.integer :write_permission
|
||||
|
||||
t.timestamps
|
||||
t.references :forumgroup
|
||||
end
|
||||
end
|
||||
end
|
||||
17
db/migrate/00000000000007_create_forumthreads.rb
Normal file
17
db/migrate/00000000000007_create_forumthreads.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class CreateForumthreads < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :forumthreads do |t|
|
||||
t.string :title
|
||||
t.text :content
|
||||
t.boolean :sticky, :default => false
|
||||
t.boolean :locked, :default => false
|
||||
|
||||
t.references :user_author
|
||||
t.references :user_editor
|
||||
|
||||
t.references :forum
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,20 +0,0 @@
|
||||
class CreateUsers < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :users do |t|
|
||||
t.string :name, :unique => true, :null => false
|
||||
t.string :ign, :unique => true, :null => false
|
||||
t.integer :rank, :default => 10, :null => false
|
||||
t.boolean :banned, :default => false
|
||||
t.string :email, :unique => true, :null => false
|
||||
t.text :about
|
||||
t.string :password_digest, :null => false
|
||||
t.string :last_ip
|
||||
t.string :skype
|
||||
t.boolean :skype_public, :default => false
|
||||
t.datetime :last_login
|
||||
t.datetime :last_active
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
class AddYoutubeToUsers < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :youtube, :string
|
||||
end
|
||||
end
|
||||
@@ -1,8 +0,0 @@
|
||||
class AddYoutubeChannelname < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :users, :youtube_channelname, :string
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
class AddTwitterToUsers < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :users, :twitter, :string
|
||||
end
|
||||
end
|
||||
@@ -1,9 +0,0 @@
|
||||
class AddForumgroups < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :forumgroups do |t|
|
||||
t.string :name
|
||||
t.integer :position
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
12
db/migrate/20130922181339_add_sessions_table.rb
Normal file
12
db/migrate/20130922181339_add_sessions_table.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
class AddSessionsTable < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :sessions do |t|
|
||||
t.string :session_id, :null => false
|
||||
t.text :data
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :sessions, :session_id
|
||||
add_index :sessions, :updated_at
|
||||
end
|
||||
end
|
||||
82
db/schema.rb
82
db/schema.rb
@@ -11,57 +11,85 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130802051521) do
|
||||
ActiveRecord::Schema.define(:version => 20130922181339) do
|
||||
|
||||
create_table "blogposts", :force => true do |t|
|
||||
t.string "title"
|
||||
t.text "text"
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.text "content"
|
||||
t.integer "user_author_id"
|
||||
t.integer "user_editor_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "comments", :force => true do |t|
|
||||
t.text "text"
|
||||
t.integer "user_id"
|
||||
t.text "content"
|
||||
t.integer "user_author_id"
|
||||
t.integer "user_editor_id"
|
||||
t.integer "blogpost_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "forumgroups", :force => true do |t|
|
||||
t.string "name"
|
||||
t.integer "position"
|
||||
t.string "name"
|
||||
t.integer "position"
|
||||
t.integer "read_permission"
|
||||
t.integer "write_permission"
|
||||
end
|
||||
|
||||
create_table "forums", :force => true do |t|
|
||||
t.string "name"
|
||||
t.integer "position"
|
||||
t.integer "read_permission"
|
||||
t.integer "write_permission"
|
||||
t.integer "forumgroup_id"
|
||||
end
|
||||
|
||||
create_table "forumthreads", :force => true do |t|
|
||||
t.string "title"
|
||||
t.text "content"
|
||||
t.boolean "sticky", :default => false
|
||||
t.boolean "locked", :default => false
|
||||
t.integer "user_author_id"
|
||||
t.integer "user_editor_id"
|
||||
t.integer "forum_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "roles", :force => true do |t|
|
||||
t.string "name"
|
||||
t.integer "value"
|
||||
end
|
||||
|
||||
create_table "sessions", :force => true do |t|
|
||||
t.string "session_id", :null => false
|
||||
t.text "data"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "forums", :force => true do |t|
|
||||
t.string "name"
|
||||
t.integer "position"
|
||||
t.integer "forumgroup_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
|
||||
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
|
||||
|
||||
create_table "users", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.string "ign", :null => false
|
||||
t.integer "rank", :default => 10, :null => false
|
||||
t.boolean "banned", :default => false
|
||||
t.string "email", :null => false
|
||||
t.text "about"
|
||||
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"
|
||||
t.boolean "skype_public", :default => false
|
||||
t.datetime "last_login"
|
||||
t.datetime "last_active"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "youtube"
|
||||
t.string "youtube_channelname"
|
||||
t.string "twitter"
|
||||
t.datetime "last_login"
|
||||
t.integer "role_id", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
40
db/seeds.rb
40
db/seeds.rb
@@ -1,12 +1,42 @@
|
||||
# This file should contain all the record creation needed to seed the database with its default values.
|
||||
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
||||
#
|
||||
User.create(
|
||||
|
||||
Role.create!([
|
||||
{name: "disabled", value: 1},
|
||||
{name: "banned", value: 2},
|
||||
{name: "unconfirmed", value: 5},
|
||||
{name: "default", value: 10},
|
||||
{name: "donor", value: 40},
|
||||
{name: "mod", value: 100},
|
||||
{name: "admin", value: 200},
|
||||
{name: "superadmin", value: 500}
|
||||
])
|
||||
|
||||
userpw = SecureRandom.hex(64)
|
||||
|
||||
deleted_user = User.create!(
|
||||
name: "Deleted user",
|
||||
email: "redstonerserver@gmail.com",
|
||||
ign: "Mojang",
|
||||
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")
|
||||
|
||||
User.create!(
|
||||
name: "Redstone Sheep",
|
||||
ign: "noobkackboon",
|
||||
email: "theredstonesheep@gmail.com",
|
||||
about: "Hi, I am the admin :)",
|
||||
password: "123",
|
||||
password_confirmation: "123",
|
||||
rank: 500
|
||||
password: "123456789",
|
||||
password_confirmation: "123456789",
|
||||
role: Role.get(:superadmin),
|
||||
confirm_code: SecureRandom.hex(16)
|
||||
)
|
||||
Reference in New Issue
Block a user