-- ===========================================================================
-- Migration: Hatchery accounting
-- Date: 2026-07-30
--
-- Buying in hatching eggs is a real operating cost that previously never
-- reached the ledger. These columns let a "bought" set record HOW it was paid
-- (cash/bank now, or on credit) so the purchase can post to the books the same
-- way a feed purchase does — Dr Hatchery Expense, Cr Cash/Bank (paid) or
-- Accounts Payable (credit) — and be settled later if bought on credit.
-- Idempotent (MariaDB ADD COLUMN IF NOT EXISTS).
-- ===========================================================================

ALTER TABLE hatch_sets
  ADD COLUMN IF NOT EXISTS payment_status ENUM('paid','credit') NULL AFTER egg_unit_cost,
  ADD COLUMN IF NOT EXISTS payment_method VARCHAR(40)           NULL AFTER payment_status,
  ADD COLUMN IF NOT EXISTS settled_on     DATE                  NULL AFTER payment_method;
