Class: CreateQuestions

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/surveyor/templates/db/migrate/create_questions.rb

Class Method Summary collapse

Class Method Details

.downObject



34
35
36
# File 'lib/generators/surveyor/templates/db/migrate/create_questions.rb', line 34

def self.down
  drop_table :questions
end

.upObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/generators/surveyor/templates/db/migrate/create_questions.rb', line 3

def self.up
  create_table :questions do |t|
    # Context
    t.integer :survey_section_id
    t.integer :question_group_id

    # Content
    t.text :text
    t.text :short_text # For experts (ie non-survey takers). Short version of text
    t.text :help_text
    t.string :pick

    # Reference
    t.string :reference_identifier # from paper
    t.string :data_export_identifier # data export
    t.string :common_namespace # maping to a common vocab
    t.string :common_identifier # maping to a common vocab

    # Display
    t.integer :display_order
    t.string :display_type
    t.boolean :is_mandatory
    t.integer :display_width # used only for slider component (if needed)

    t.string :custom_class
    t.string :custom_renderer

    t.timestamps
  end
end