class CreateOwnerInitializations < ActiveRecord::Migration
  def change
    create_table :owner_initializations do |t|
      t.belongs_to :workflow_instance, index: true
      t.string :state
      t.string :type
      t.text :notes

      t.boolean :checked, default: false, null: false
      t.date :plan_date
      t.string :my_identifier
      t.integer :window_from
      t.integer :window_to
      t.integer :number_of_visits
      t.float :my_fraction
      t.text :my_explanation

      t.timestamps null: false
    end

    WorkflowInstance::Scenario1.pluck(:id).each{|id| OwnerInitialization::Scenario1.create!(workflow_instance_id: id) }
  end
end
