Delete a report and pause its schedules
What It Does
An authorized owner, report manager or granted staff member requests report deletion with the version read. Saved-query removal remains refused while report, dashboard or schedule dependencies exist.
The Flow
Resolve the visible report and confirm the caller’s modification authority. Pause dependent schedules with report_deleted, then remove the report, source rows and roles using the read version. Database relationships clear report references from retained files and schedules and release saved-query dependencies. A later renderer checks its queued request against the now-missing report.
When Something Fails
Refuse a hidden report or missing authority. The report and schedules remain unchanged. Rollback pauses and removal on conflict or another transactional failure. No pause-only partial deletion is committed. Foreign-key effects follow the deleting transaction. Completed file objects are retained under their existing access and expiry behavior. Record access_lost for that queued render. Previously completed files are unaffected by this failed render.
Idempotency and Concurrency
Repeated deletion receives not found once the report has gone; it cannot repeat the original deletion transaction. Report removal and schedule pauses share a transaction. A stale version or record lock rolls both back; already-running work performs its own source checks.