-- Furnify payment and PWA install helper migration
-- Run this once if you already imported an older Furnify database.

ALTER TABLE orders ADD COLUMN payment_status VARCHAR(80) NOT NULL DEFAULT 'Unpaid' AFTER payment_method;
ALTER TABLE orders ADD COLUMN payment_reference VARCHAR(140) NULL AFTER payment_status;
ALTER TABLE orders ADD COLUMN payment_proof_path VARCHAR(255) NULL AFTER payment_reference;
ALTER TABLE orders ADD COLUMN payment_link VARCHAR(500) NULL AFTER payment_proof_path;
ALTER TABLE orders ADD COLUMN amount_paid DECIMAL(12,2) NOT NULL DEFAULT 0 AFTER payment_link;
ALTER TABLE orders ADD COLUMN balance_due DECIMAL(12,2) NOT NULL DEFAULT 0 AFTER amount_paid;
ALTER TABLE orders ADD INDEX idx_orders_payment_status (payment_status);
