-- ============================================================================ -- Add QR String Support to Orders -- ============================================================================ -- Stores QRIS string and expiry for in-app QR code display -- Eliminates need to redirect to external payment page -- ============================================================================ -- Add columns for QRIS payment data ALTER TABLE orders ADD COLUMN IF NOT EXISTS qr_string TEXT, ADD COLUMN IF NOT EXISTS qr_expires_at TIMESTAMPTZ; -- Add index for cleanup of expired QR codes CREATE INDEX IF NOT EXISTS idx_orders_qr_expires_at ON orders(qr_expires_at) WHERE qr_expires_at IS NOT NULL; -- Add comment COMMENT ON COLUMN orders.qr_string IS 'QRIS payment string for generating QR code in-app. Cleared after payment or expiration.'; COMMENT ON COLUMN orders.qr_expires_at IS 'QRIS code expiration timestamp. Used for cleanup and validation.';