class CreateEcomCoreTasks < ActiveRecord::Migration[6.0] def change create_table :ecom_core_tasks do |t| t.string :code, null: false t.string :name, null: false t.string :description t.string :ancestry t.date :start_date t.date :end_date t.string :status, null: false, default: :new t.integer :percent_completed, null: false, default: 0 t.string :remark t.references :work_package, null: true, index: { name: 'tasks_on_work_package_indx' }, foreign_key: { to_table: :ecom_core_work_packages } t.references :work_order, null: true, index: { name: 'tasks_on_wo_indx' }, foreign_key: { to_table: :ecom_core_work_orders } t.references :plan, null: true, index: { name: 'tasks_on_plan_indx' }, foreign_key: { to_table: :ecom_core_plans } t.references :performer, null: true, index: { name: 'tasks_on_performer_indx' }, foreign_key: { to_table: :ecom_core_users } t.references :approver, null: true, index: { name: 'tasks_on_approver_indx' }, foreign_key: { to_table: :ecom_core_users } t.references :supervisor, null: true, index: { name: 'tasks_on_supervisor_indx' }, foreign_key: { to_table: :ecom_core_users } t.references :quality_controller, null: true, index: { name: 'tasks_on_qc_indx' }, foreign_key: { to_table: :ecom_core_users } t.references :work_product, null: false, index: { name: 'tasks_on_wp_indx' }, foreign_key: { to_table: :ecom_core_work_products } t.references :task_template, null: false, index: { name: 'tt_on_project_indx' }, foreign_key: { to_table: :ecom_core_task_templates } t.timestamps end end end