Getting Started
Tutorial: Building with CleaveDB
Cascade on Delete
When modeling parent-child hierarchies—such as an order and its line items, or an article and its attachments—deleting the parent document should often delete the dependent child entities as well. CleaveQL enables this behavior using ON DELETE CASCADE on graph bonds.
Configuring a cascading bond
Append ON DELETE CASCADE to your BOND command:
CleaveQLExample · Cascade order items on deletion
BOND "orders:ord_1" TO "line_items:item_1" AS "contains" ON DELETE CASCADEIf "orders:ord_1" is subsequently soft-deleted with DRAIN, CleaveDB automatically cascades the soft-deletion to "line_items:item_1", moving both records into _rubbish.
Cascading recovery with SALVAGE
Cascade rules also operate during recovery workflows:
CleaveQLExample · Restore order and cascaded items
SALVAGE orders "ord_1"CleaveDB recognizes the cascade metadata, restoring the parent order alongside all its linked child line items and reactivating the bonds between them.
