feat: Add script to clean orphaned reference records

Instances that accumulated project managers, favorites, board memberships
or board subscriptions pointing at a project or board that no longer exists
had no way to find or clear them.

The script reports by default and only deletes with `--apply`, which first
asks whether a backup exists and refuses outright without a terminal to ask
on. It removes nothing but reference rows: structural orphans such as a
board without a project carry user content, and a membership whose
denormalized project is stale still grants real access to an existing
board, so both are reported and left alone.
This commit is contained in:
Daniel Hiller
2026-08-26 09:31:18 +02:00
parent 2d289cd3d5
commit d7da44efe4
3 changed files with 188 additions and 0 deletions
+1
View File
@@ -14,6 +14,7 @@
"prepare": "husky",
"server:build": "npm run build --prefix server",
"server:console": "npm run console --prefix server",
"server:db:clean-orphaned-records": "npm run db:clean-orphaned-records --prefix server",
"server:db:create-admin-user": "npm run db:create-admin-user --prefix server",
"server:db:init": "npm run db:init --prefix server",
"server:db:migrate": "npm run db:migrate --prefix server",