diff --git a/src/lib/db/migrations/0051_documents_hub_split.sql b/src/lib/db/migrations/0051_documents_hub_split.sql index c1c41f31..92501247 100644 --- a/src/lib/db/migrations/0051_documents_hub_split.sql +++ b/src/lib/db/migrations/0051_documents_hub_split.sql @@ -1,8 +1,10 @@ -- Wave 11.B+: documents hub split + auto-filed client folders. -- Adds system-managed folder lifecycle columns to document_folders --- (Clients/Companies/Yachts roots + per-entity subfolders), adds the --- folder_id pointer to files, and backfills the structure for every --- existing port + file. Idempotent — safe to re-run. +-- (Clients/Companies/Yachts roots + per-entity subfolders) and the +-- folder_id pointer to files. Backfill (ensureSystemRoots + per- +-- entity subfolders + files.folder_id from entity FKs) runs as a +-- separate deploy step — see scripts/backfill-document-folders.ts. +-- Idempotent — safe to re-run. -- ─── document_folders: lifecycle columns ────────────────────────────────── ALTER TABLE "document_folders"