Sha256: 56aefa9859ea5bca06a82bb6933b5822704db0ba21f5ef26db3978f221ebd456

Contents?: true

Size: 1.78 KB

Versions: 5

Compression:

Stored size: 1.78 KB

Contents

class CreateEcomModelWorkProducts < ActiveRecord::Migration[6.0]
  def change
    create_table :ecom_model_work_products do |t|
      t.string :code, null: false
      t.string :name, null: false
      t.string :description
      t.string :design_reference_no, unique: true
      t.json :dimension
      t.references :task, index: { name: 'task_on_wp_indx' }
      t.references :work_product_template, index: { name: 'wpt_on_wp_indx' }
      t.references :project, index: { name: 'projects_on_wp_indx' }
      t.string :assignment_status, default: 'UNASSIGNED'
      t.string :task_status, default: 'NEW'
      t.integer :percent_completed
      t.string :remark
      t.references :performer, index: { name: 'pr_on_work_product_indx' }
      t.references :approver, index: { name: 'app_on_work_product_indx' }
      t.references :supervisor, index: { name: 'sup_on_work_product_indx' }
      t.references :quality_controller, index: { name: 'qut_ctr_on_work_product_indx' }
      t.datetime :start_date
      t.datetime :completion_date

      t.timestamps
    end
    add_index :ecom_model_work_products, %i[code project_id], unique: true
    add_foreign_key :ecom_model_work_products, :ecom_model_tasks, column: :task_id
    add_foreign_key :ecom_model_work_products, :ecom_model_work_product_templates,
                    column: :work_product_template_id
    add_foreign_key :ecom_model_work_products, :ecom_model_projects, column: :project_id
    add_foreign_key :ecom_model_work_products, :ecom_model_users, column: :performer_id
    add_foreign_key :ecom_model_work_products, :ecom_model_users, column: :approver_id
    add_foreign_key :ecom_model_work_products, :ecom_model_users, column: :supervisor_id
    add_foreign_key :ecom_model_work_products, :ecom_model_users, column: :quality_controller_id
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ecom_model-2.0.4 db/migrate/20191202235434_create_ecom_model_work_products.rb
ecom_model-2.0.3 db/migrate/20191202235434_create_ecom_model_work_products.rb
ecom_model-2.0.2 db/migrate/20191202235434_create_ecom_model_work_products.rb
ecom_model-2.0.1 db/migrate/20191202235434_create_ecom_model_work_products.rb
ecom_model-2.0.0 db/migrate/20191202235434_create_ecom_model_work_products.rb