Skip to content

delete pdfs, storage files when deleting a workspace#776

Merged
moehdotdev merged 1 commit into
mainfrom
backend-logic
Jun 1, 2026
Merged

delete pdfs, storage files when deleting a workspace#776
moehdotdev merged 1 commit into
mainfrom
backend-logic

Conversation

@moehdotdev

Copy link
Copy Markdown
Member

what changed

  • deleteWorkingSpace now collects all pdfs associated with the workspace before deleting it, covering two cases:
    • pdfs linked directly via by_workingSpaceId index
    • pdfs linked to a table within the workspace via by_notesTableId index
  • both sets are merged and deduplicated (in case a pdf has both a workingSpaceId and a notesTableId pointing to the same workspace)
  • for each pdf, ctx.storage.delete is called first to remove the actual file from convex storage, then ctx.db.delete removes the record
  • this runs before the tables are deleted so the notesTableId references are still valid during the storage cleanup

why

before this, deleting a workspace left orphaned pdf records in the db and their files sitting in convex storage indefinitely since there was no owner left to clean them up.

@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
notevo Building Building Preview, Comment Jun 1, 2026 3:52pm

@moehdotdev moehdotdev merged commit 77974d5 into main Jun 1, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant