---
name: bijection-cascading-deletes
description: "Evaluate and integrate the Cascading Deletes component with Bijection."
---

# Cascading Deletes

Relationship-based cleanup

- Package: @bijectionhq/cascading-deletes
- Category: Database & Backend
- Status: Reference
- License: Apache-2.0
- Bijection source (repository access required): https://github.com/bijectionhq/cascading-deletes/tree/acb1222095c6f18a7f6e0e949894cbf4717970c9
- Upstream: https://github.com/sholajegede/convex-cascading-deletes/tree/33ebb486a722c08450dc5a8e016af9e60980ed24
- Documentation: https://docs.bijection.com/components/using
- Directory: https://bijection.com/components/cascading-deletes

## Get the source

Bijection repository access is required. Request access at https://bijection.com/contact.

```sh
git clone https://github.com/bijectionhq/cascading-deletes.git
cd cascading-deletes
git checkout acb1222095c6f18a7f6e0e949894cbf4717970c9
```

## Before using this component

Read the package README at the recorded revision for setup, dependencies, and API examples. Upstream documentation describes the original package and may differ from the Bijection adaptation. This is a source candidate for evaluation. Catalog inclusion does not establish npm availability or runtime qualification. Check compatibility with your SDK and deployment before adoption. External providers run their own compute.

## Integration workflow

1. Read the source README and package manifest at the recorded revision.
2. Confirm the required SDK, dependency availability, and runtime compatibility.
3. Follow the component's documented setup and configuration. Never invent an npm install command from a catalog package name.
4. Keep credentials in the project's existing secret store.
5. Follow the project's execution rules for verification and report what was actually checked.

## Original upstream skill

The following guidance describes @sholajegede/convex-cascading-deletes. Its installation commands and APIs refer to the upstream package. Evaluate compatibility with the Bijection source separately.


# Cascading Deletes

## Instructions

Use Cascading Deletes to automatically delete related convex documents in one call using your existing indexes to define parent-child relationships. This Convex component integrates directly with your backend.

### Installation

```bash
npm install @sholajegede/convex-cascading-deletes
```

### Capabilities

- Delete records with all dependents in a single deleteWithCascade() call instead of manual cleanup
- Configure relationships once using existing indexes, no schema changes or additional setup required
- Process large deletion trees automatically via scheduler batching with atomic guarantees per batch
- Prevent data corruption with circular relationship protection and optional enforcement of cascade-only deletions

## Examples

### how to delete user and all related data in Convex

The Cascading Deletes component lets you delete a user and cascade to all their posts, comments, and other related records automatically. Configure relationships via your existing indexes, then call deleteWithCascade() instead of manual cleanup across multiple tables.

### Convex referential integrity foreign key constraints

While Convex doesn't have built-in foreign key constraints, this component provides referential integrity through cascading deletes. Define parent-child relationships using your existing indexes and ensure dependent records are always cleaned up when parents are deleted.

### batch delete related documents Convex scheduler

Large deletion trees are automatically processed in batches via the Convex scheduler, with atomic guarantees within each batch. The component handles the complexity of recursive dependency resolution and maintains deletion logs for audit purposes.

## When NOT to use

- When a simpler built-in solution exists for your specific use case
- If you are not using Convex as your backend
- When the functionality provided by Cascading Deletes is not needed

## Troubleshooting

**How does the Cascading Deletes component handle circular relationships?**

The Cascading Deletes component includes built-in circular relationship protection using visited tracking to prevent infinite loops. This ensures that complex relationship graphs with circular dependencies can be safely deleted without causing stack overflows or endless deletion cycles.

**Do I need to modify my existing Convex schema to use cascading deletes?**

No schema changes are required. The Cascading Deletes component uses your existing indexes to define relationships between tables. You simply configure which indexes represent parent-child relationships and the component handles the rest automatically.

**What happens if a cascading delete operation fails partway through?**

Deletions within each scheduler batch are atomic, so partial batches won't leave your database in an inconsistent state. If a batch fails, only that specific batch is rolled back while previous successful batches remain committed. The component logs all operations for audit and debugging purposes.

**Can I query which records were deleted in a cascading operation?**

Yes, the Cascading Deletes component maintains a reactive deletion log that tracks every cascade operation with per-table counts and timestamps. You can query this log using useQuery to see exactly which records were deleted and when the cascade ran.

## Resources

- [npm package](https://www.npmjs.com/package/%40sholajegede%2Fconvex-cascading-deletes)
- [GitHub repository](https://github.com/sholajegede/convex-cascading-deletes)
- [Live demo](https://convex-cascading-deletes-demo.vercel.app)
- [Convex Components Directory](https://www.convex.dev/components/sholajegede/convex-cascading-deletes)
- [Convex documentation](https://docs.convex.dev)