class CreateRafts < ActiveRecord::Migration[8.0] def change create_table :rafts do |t| t.references :bed, null: false, foreign_key: true t.integer :location, null: false t.references :crop, null: true, foreign_key: true t.timestamps end add_index :rafts, [ :bed_id, :location ], unique: true end end