4bbd93ded1
Adding the .ruby-verison file triggered previously un-run cops, specifically: This cop is designed to help upgrade to Ruby 3.0. It will add the comment `# frozen_string_literal: true` to the top of files to enable frozen string literals. Frozen string literals will be default in Ruby 3.0. The comment will be added below a shebang and encoding comment. The frozen string literal comment is only valid in Ruby 2.3+. More info on rubocop [Automatic-Corrections](https://github.com/bbatsov/rubocop/wiki/Automatic-Corrections)
65 lines
1.6 KiB
Ruby
65 lines
1.6 KiB
Ruby
# frozen_string_literal: true
|
|
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
|