Class: CreateDependencyConditions

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

Class Method Summary collapse

Class Method Details

.downObject



27
28
29
# File 'lib/generators/surveyor/templates/db/migrate/create_dependency_conditions.rb', line 27

def self.down
  drop_table :dependency_conditions
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
# File 'lib/generators/surveyor/templates/db/migrate/create_dependency_conditions.rb', line 3

def self.up
  create_table :dependency_conditions do |t|
    # Context
    t.integer :dependency_id
    t.string :rule_key

    # Conditional
    t.integer :question_id # the conditional question
    t.string :operator

    # Value
    t.integer :answer_id
    t.datetime :datetime_value
    t.integer :integer_value
    t.float :float_value
    t.string :unit
    t.text :text_value
    t.string :string_value
    t.string :response_other

    t.timestamps
  end
end