-- financial-statements (wave-13): covering indexes for P&L and Cash Flow report queries.
-- All four indexes are idempotent (IF NOT EXISTS).

CREATE INDEX IF NOT EXISTS idx_invoices_report
  ON invoices (tenant_id, status, tax_issue_date);
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS idx_expenses_report
  ON expenses (tenant_id, status, expense_date);
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS idx_invoice_payments_rpt
  ON invoice_payments (tenant_id, paid_at);
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS idx_payout_bills_rpt
  ON payout_bills (tenant_id, status, paid_at);
