models and fixtures and seeds
This commit is contained in:
63
db/migrate/20160726193255_db_init.rb
Normal file
63
db/migrate/20160726193255_db_init.rb
Normal file
@ -0,0 +1,63 @@
|
||||
class DbInit < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :candidates do |t|
|
||||
t.string :test_hash, null: false
|
||||
t.string :name
|
||||
t.string :email
|
||||
t.string :experience
|
||||
t.integer :recruiter_id
|
||||
t.boolean :completed, null: false, default: false
|
||||
t.boolean :reminded, null: false, default: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :candidates, :test_hash, unique: true
|
||||
add_index :candidates, :recruiter_id
|
||||
|
||||
create_table :questions do |t|
|
||||
t.integer :quiz_id
|
||||
t.text :question
|
||||
t.string :category
|
||||
t.string :input_type
|
||||
t.text :input_options
|
||||
t.string :sort, null: false, default: 0
|
||||
t.boolean :active, null: false, default: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :questions, :quiz_id
|
||||
add_index :questions, :sort
|
||||
add_index :questions, :active
|
||||
|
||||
create_table :answers do |t|
|
||||
t.integer :candidate_id
|
||||
t.integer :question_id
|
||||
t.text :answer
|
||||
t.integer :saved, null: false, default: 0
|
||||
t.boolean :submitted, null: false, default: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :answers, :candidate_id
|
||||
add_index :answers, :question_id
|
||||
add_index :answers, :submitted
|
||||
|
||||
create_table :quizzes do |t|
|
||||
t.string :unit
|
||||
t.string :dept
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
create_table :users do |t|
|
||||
t.string :name, null: false
|
||||
t.string :email, null: false
|
||||
t.string :password_digest
|
||||
t.string :role, null: false
|
||||
t.boolean :active, null: false, default: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :users, :email, unique: true
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user