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.float :quantity t.string :remark t.date :inspection_submission_date t.string :inspection_status, null: false, default: 'Not Inspected' t.boolean :change_order, null: false, default: false t.integer :percentage_contribution t.references :change_order_for, null: true, index: { name: 'tasks_on_cot_indx' }, foreign_key: { to_table: :ecom_core_tasks } 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 :performer, null: true, index: { name: 'tasks_on_performer_indx' }, foreign_key: { to_table: :ecom_core_users } t.references :client_consultant, null: true, index: { name: 'tasks_on_cc_indx' }, foreign_key: { to_table: :ecom_core_users } t.references :foreman, null: true, index: { name: 'tasks_on_foreman_indx' }, foreign_key: { to_table: :ecom_core_users } t.references :inspector, null: true, index: { name: 'tasks_on_inspector_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