mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[GH-ISSUE #5654] [Enhancement] Add cascade delete for collections to improve deletion performance and simplify code #2191
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#2191
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @shaezard on GitHub (Dec 3, 2025).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5654
Originally assigned to: @shaezard on GitHub.
Description
When deleting a
UserCollectionorTeamCollectionthat contains nested child collections and requests, the current implementation uses recursive application-level deletion. This approach:deleteCollectionData) to handle nested deletionsCurrent Behavior
The
deleteUserCollectionanddeleteTeamCollectionmethods recursively:This results in N+1 query patterns for deeply nested collections.
Proposed Solution
Add
onDelete: Cascadeto the Prisma schema for:TeamCollection.parent→TeamCollectionrelationshipUserRequest.userCollection→UserCollectionrelationshipThis delegates cascading deletions to the database level, which:
Affected Components
packages/hoppscotch-backend/prisma/schema.prismapackages/hoppscotch-backend/src/user-collection/user-collection.service.tspackages/hoppscotch-backend/src/team-collection/team-collection.service.tsAdditional Context
The
TeamCollection→TeamandUserRequest→Userrelationships already useonDelete: Cascade, so this change follows the existing pattern in the codebase.@jamesgeorge007 commented on GitHub (Jan 28, 2026):
This is now addressed in the v2026.1.0 release.