class CreateMksEdmEquipmentLocations < ActiveRecord::Migration[5.1] def change create_table :mks_edm_equipment_locations do |t| t.string :code, unique: true t.string :name, null: false t.references :location_type, index: { name: 'lt_on_el_indx' } t.string :description t.string :address t.timestamps end add_foreign_key :mks_edm_equipment_locations, :mks_edm_location_types, column: :location_type_id end end