LOTS of stuff
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
26
db/migrate/02_create_users.rb
Normal file
26
db/migrate/02_create_users.rb
Normal file
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
10
db/migrate/09_create_register_tokens.rb
Normal file
10
db/migrate/09_create_register_tokens.rb
Normal file
@@ -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
|
||||
13
db/migrate/10_create_threadreplies.rb
Normal file
13
db/migrate/10_create_threadreplies.rb
Normal file
@@ -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
|
||||
22
db/schema.rb
22
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
|
||||
|
||||
27
db/seeds.rb
27
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)
|
||||
)
|
||||
role: Role.get(:superadmin)
|
||||
)
|
||||
Reference in New Issue
Block a user