Merge branch 'adding_surveys' of https://github.com/mdeniz/osem into mdeniz-adding_surveys

This commit is contained in:
Henne Vogelsang 2016-07-01 10:32:07 +02:00
commit 1991f53f26
40 changed files with 694 additions and 33 deletions

View file

@ -0,0 +1,13 @@
class CreateSurveys < ActiveRecord::Migration
def change
create_table :surveys do |t|
t.datetime :start_date
t.datetime :end_date
t.string :title
t.text :description
t.references :surveyable, polymorphic: true, index: true
t.timestamps null: false
end
end
end

View file

@ -0,0 +1,13 @@
class CreateSurveyQuestions < ActiveRecord::Migration
def change
create_table :survey_questions do |t|
t.references :survey
t.string :title
t.integer :kind, default: 0
t.integer :min_choices
t.integer :max_choices
t.text :possible_answers
t.boolean :mandatory, default: false
end
end
end

View file

@ -0,0 +1,5 @@
class AddTargetToSurveys < ActiveRecord::Migration
def change
add_column :surveys, :target, :integer, default: 0
end
end

View file

@ -0,0 +1,11 @@
class CreateSurveyReplies < ActiveRecord::Migration
def change
create_table :survey_replies do |t|
t.integer :survey_question_id
t.integer :user_id
t.text :text
t.timestamps null: false
end
end
end

View file

@ -0,0 +1,10 @@
class CreateSurveySubmissions < ActiveRecord::Migration
def change
create_table :survey_submissions do |t|
t.integer :user_id
t.integer :survey_id
t.timestamps null: false
end
end
end