Files
LambdaMail/migrations/0014_mailbox_state_single_source.down.sql
T
Lucas Rayan a8941a6191 refactor(mail): one definition of the standard folders, and reconcile the drift
The console created Reports, the CLI that makes the first administrator did not,
so that account had no folder for DMARC and TLS-RPT reports. The list now lives
in one SQL function, provision_default_folders (migration 0014), which both call.

The same migration reconciles what the two paths had left wrong in existing
mailboxes: folder counters and the mailbox's used bytes are recomputed from the
rows (only where they differ, so it is safe to run again).

create-admin can now be tested: fail() throws instead of exiting, and the command
runs only when invoked as one. The new test fails on the old code (no Reports).
2026-10-16 13:19:55 -03:00

5 lines
263 B
SQL

-- The reconciliation corrected cached numbers and cannot be undone (and has no
-- reason to be); only the function is removed. Folders it added stay: they are
-- ordinary folders by now and may hold mail.
DROP FUNCTION IF EXISTS provision_default_folders(UUID);