增加在线测试迁移问卷

This commit is contained in:
sw 2015-11-13 11:43:44 +08:00
parent 2c5cd1a4b3
commit 5a153637b7
6 changed files with 89 additions and 0 deletions

View File

@ -0,0 +1,18 @@
class Exercise < ActiveRecord::Migration
def up
create_table :exercise do |t|
t.string :exercise_name
t.text :exercise_description
t.integer :course_id
t.integer :exercise_status
t.integer :user_id
t.datetime :start_at
t.datetime :end_at
t.timestamps
end
end
def down
drop_table :exercise
end
end

View File

@ -0,0 +1,14 @@
class ExerciseQuestion < ActiveRecord::Migration
def up
create_table :exercise_question do |t|
t.string :question_title
t.integer :question_type
t.integer :exercise_id
t.timestamps
end
end
def down
drop_table :exercise_question
end
end

View File

@ -0,0 +1,14 @@
class ExerciseChoices < ActiveRecord::Migration
def up
create_table :exercise_choices do |t|
t.integer :exercise_question_id
t.text :choice_text
t.integer :choice_position
t.timestamps
end
end
def down
drop_table :exercise_choices
end
end

View File

@ -0,0 +1,14 @@
class ExerciseStandardAnswer < ActiveRecord::Migration
def up
create_table :exercise_standard_answer do |t|
t.integer :exercise_question_id
t.integer :exercise_choices_id
t.text :answer_text
t.timestamps
end
end
def down
drop_table :exercise_standard_answer
end
end

View File

@ -0,0 +1,15 @@
class ExerciseAnswer < ActiveRecord::Migration
def up
create_table :exercise_answer do |t|
t.integer :user_id
t.integer :exercise_question_id
t.integer :exercise_choices_id
t.text :answer_text
t.timestamps
end
end
def down
drop_table :exercise_answer
end
end

View File

@ -0,0 +1,14 @@
class UserExercise < ActiveRecord::Migration
def up
create_table :user_exercise do |t|
t.integer :user_id
t.integer :exercise_id
t.integer :score
t.timestamps
end
end
def down
drop_table :user_exercise
end
end