class CreateParksByStates < ActiveRecord::Migration[8.0] def change create_table :parks_by_states do |t| t.string :park_code, null: false t.string :state, null: false t.timestamps end add_index :parks_by_states, [:state, :park_code], unique: true add_index :parks_by_states, :park_code add_foreign_key :parks_by_states, :parks, column: :park_code, primary_key: :code end end