class CreateEcomCoreJobCards < ActiveRecord::Migration[6.0] def change create_table :ecom_core_job_cards do |t| t.string :code, unique: true t.date :start_date t.date :due_date t.date :checkin_date t.date :checkout_date t.boolean :approved, null: false, default: false t.boolean :checkin_confirmed, null: false, default: false t.boolean :checkout_confirmed, null: false, default: false t.boolean :costs_approved, null: false, default: false t.references :maintenance_service_order, null: false, index: { name: 'jc_on_mso_indx' }, foreign_key: { to_table: :ecom_core_maintenance_service_orders } t.references :service_provider, null: false, index: { name: 'jc_on_sp_indx' }, foreign_key: { to_table: :ecom_core_equipment_locations } t.references :checkout_by, null: true, index: { name: 'jc_on_cb_indx' }, foreign_key: { to_table: :ecom_core_users } t.references :checkout_to, null: true, index: { name: 'jc_on_ct_indx' }, foreign_key: { to_table: :ecom_core_equipment_locations } t.references :maintenance_status, null: false, index: { name: 'jc_on_ms_indx' }, foreign_key: { to_table: :ecom_core_lookups } t.references :checkin_by, null: true, index: { name: 'jc_on_cib_indx' }, foreign_key: { to_table: :ecom_core_users } t.references :checkin_to, null: true, index: { name: 'jc_on_cit_indx' }, foreign_key: { to_table: :ecom_core_equipment_locations } t.references :prepared_by, null: false, index: { name: 'jc_on_pb_indx' }, foreign_key: { to_table: :ecom_core_users } t.timestamps end end end