Sha256: fe66b6ea06a9aacbe227c88b61d83ab8e7e631188f00d777183493f4336e718b

Contents?: true

Size: 1.49 KB

Versions: 4

Compression:

Stored size: 1.49 KB

Contents

class CreateCitizenBudgetModelQuestions < ActiveRecord::Migration
  def up
    create_table :citizen_budget_model_questions do |t|
      t.belongs_to :section, index: true

      # Simulation
      t.string :machine_name, null: false, default: ''
      t.float :default_value
      t.float :unit_value
      t.string :account, null: false, default: ''

      # Widget
      t.string :widget, null: false, default: ''
      t.float :options, null: false, default: [], array: true

      # Widget text
      t.boolean :revenue, default: false

      # HTML attributes
      t.integer :maxlength
      t.boolean :required, default: false
      t.integer :rows
      t.integer :cols
      t.integer :size

      t.integer :position
      t.timestamps
    end
    CitizenBudgetModel::Question.create_translation_table!({
      # Simulation
      name: {type: :string, null: false, default: ''},

      # Question text
      title: {type: :text, null: false, default: ''},
      description: {type: :text, null: false, default: ''},
      modal: {type: :text, null: false, default: ''},
      popover: {type: :text, null: false, default: ''},

      # Widget
      labels: {type: :string, null: false, default: [], array: true},

      # Widget text
      unit_name: {type: :string, null: false, default: ''},

      # HTML attributes
      placeholder: {type: :string, null: false, default: ''},
    })
  end

  def down
    drop_table :citizen_budget_model_questions
    CitizenBudgetModel::Question.drop_translation_table!
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
citizen_budget_model-0.0.4 db/migrate/20140730020214_create_citizen_budget_model_questions.rb
citizen_budget_model-0.0.3 db/migrate/20140730020214_create_citizen_budget_model_questions.rb
citizen_budget_model-0.0.2 db/migrate/20140730020214_create_citizen_budget_model_questions.rb
citizen_budget_model-0.0.1 db/migrate/20140730020214_create_citizen_budget_model_questions.rb