class CreateMksRateRateChangeRequests < ActiveRecord::Migration[5.1] def change create_table :mks_rate_rate_change_requests do |t| t.string :reference_number, unique: true t.string :authorized_by, null: false t.date :effective_on, null: false t.date :authorized_on, null: false t.json :rates, null: false t.string :status, null: false, default: 'SUBMITTED' t.references :created_by, index: { name: 'cb_on_rcr_indx' } t.references :approved_by, index: { name: 'ab_on_rcr_indx' } t.string :remark t.timestamps end add_index :mks_rate_rate_change_requests, :reference_number, unique: true add_foreign_key :mks_rate_rate_change_requests, :mks_auth_users, column: :created_by_id add_foreign_key :mks_rate_rate_change_requests, :mks_auth_users, column: :approved_by_id end end