Files
accounted/supabase/migrations/20260825170000_lock_down_invoice_backfill_snapshot.sql
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
2026-11-10 09:37:22 +01:00

25 lines
1.6 KiB
SQL

-- Contain the invoice remaining-balance backfill snapshot created during the
-- 2026-08-17 production repair recorded in PR #1655. The table is not part of
-- the application schema and no runtime code references it, but production
-- retains 337 financial snapshot rows whose retention status is unresolved.
-- Preserve the rows for review while removing every browser-facing access
-- path. The service role remains read-only for an authorized retention audit,
-- while the table owner retains control for a separately approved decision.
--
-- Fresh databases do not contain this incident artifact, so the migration is
-- deliberately conditional. Retention, relocation, or deletion is a separate
-- decision and must not be inferred from this access-containment change.
DO $$
BEGIN
IF pg_catalog.to_regclass('public._backfill_remaining_20260817') IS NOT NULL THEN
EXECUTE 'ALTER TABLE public._backfill_remaining_20260817 ENABLE ROW LEVEL SECURITY';
EXECUTE 'REVOKE ALL PRIVILEGES ON TABLE public._backfill_remaining_20260817 FROM PUBLIC, anon, authenticated';
EXECUTE 'REVOKE INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER ON TABLE public._backfill_remaining_20260817 FROM service_role';
EXECUTE 'GRANT SELECT ON TABLE public._backfill_remaining_20260817 TO service_role';
EXECUTE 'COMMENT ON TABLE public._backfill_remaining_20260817 IS ''Invoice remaining-balance repair snapshot from 2026-08-17. Browser access is revoked. Retention, relocation, or deletion requires a separate approved decision.''';
END IF;
END;
$$;
NOTIFY pgrst, 'reload schema';