class CreateMksRateChargeableServices < ActiveRecord::Migration[5.1] def change create_table :mks_rate_chargeable_services do |t| t.string :code, null: false t.string :name, null: false t.integer :service_type_id, index: { name: 'st_on_cs_indx' } t.integer :base_unit_id, index: {name: 'bu_on_cs_indx' } t.integer :utilization_unit_id, index: { name: 'uu_on_cs_indx' } t.integer :service_delivery_unit_id, index: { name: 'sdu_on_cs_indx' } t.timestamps end add_foreign_key :mks_rate_chargeable_services, :mks_rate_service_types, column: :service_type_id add_foreign_key :mks_rate_chargeable_services, :mks_rate_unit_of_charges, column: :base_unit_id add_foreign_key :mks_rate_chargeable_services, :mks_rate_unit_of_charges, column: :utilization_unit_id add_foreign_key :mks_rate_chargeable_services, :mks_rate_service_delivery_units, column: :service_delivery_unit_id end end