class CreateMksEdmEquipmentItems < ActiveRecord::Migration[5.1] def change create_table :mks_edm_equipment_items do |t| t.string :code, unique: true t.string :name, null: false t.string :description t.string :status, default: 'READY' t.string :serial_number, unique: true t.string :brand t.string :item_model t.float :purchase_price, null: false t.date :purchase_date, null: false t.float :license_fee t.float :tax t.references :equipment, index: { name: 'equipment_on_ei_indx' } t.references :current_location, index: { name: 'equipment_on_el_indx' } t.timestamps end add_foreign_key :mks_edm_equipment_items, :mks_edm_equipments, column: :equipment_id add_foreign_key :mks_edm_equipment_items, :mks_edm_equipment_locations, column: :current_location_id end end