-- ═══════════════════════════════════════════════════════════════════════
-- Bulk Fee Payment — Phase 3 schema (feature: bulk_fee_payment)
--
-- online_payments.weeks_covered: how many weeks of feeding the payer says
-- this transaction covers, same concept as the cash/bursar side's
-- weeks_covered form field. Without this, every online payment that
-- includes a feeding-fee item generates exactly 1 week of canteen
-- entitlement regardless of how much was actually paid, because
-- canteen_auto_generate_entitlement() defaults to 1 week when no explicit
-- count is passed — the webhooks never had anywhere to read a real count
-- from. Defaults to 1 so existing/pending rows behave exactly as before.
--
-- Idempotent on MariaDB (XAMPP), matching every other migration in this folder.
-- ═══════════════════════════════════════════════════════════════════════

ALTER TABLE `online_payments`
    ADD COLUMN IF NOT EXISTS `weeks_covered` INT(11) NOT NULL DEFAULT 1 AFTER `fee_structure_ids`;
