docs: clarify how links with cascade deletion are deleted (#14155)

* docs: clarify how links with cascade deletion are deleted

* small change
This commit is contained in:
Shahed Nasser authored and GitHub committed 2025-12-01 09:01:50 +02:00
1 parent 1e2f40b623
commit 815464e007
4 files changed
+10 -10

No files matched your search

+4 -4
View File
@@ -15622,7 +15622,7 @@ The keys (names of linked modules) must be in the same [direction](https://docs.
## Cascade Delete Linked Records
If a record is deleted, use the `delete` method of Link to delete all linked records.
If you delete a record using a workflow or its module's service, use the `delete` method of Link to delete all linked records whose links are defined with [cascade deletion](https://docs.medusajs.com/learn/fundamentals/module-links#set-delete-cascades-on-link/index.html.md).
For example:
@@ -15631,7 +15631,7 @@ import { Modules } from "@medusajs/framework/utils"
// ...
await productModuleService.deleteVariants([variant.id])
await productModuleService.deleteProducts(["prod_123"])
await link.delete({
[Modules.PRODUCT]: {
@@ -15802,7 +15802,7 @@ export default defineLink(
## Set Delete Cascades on Link
To enable delete cascade on a link so that when a record is deleted, its linked records are also deleted, pass the `deleteCascade` property in the object passed to `defineLink`.
To enable delete cascade on a link so that when a record is deleted with [link.delete](https://docs.medusajs.com/learn/fundamentals/module-links/link#cascade-delete-linked-records/index.html.md), its linked records are also deleted, pass the `deleteCascade` property in the object passed to `defineLink`.
For example:
@@ -15820,7 +15820,7 @@ export default defineLink(
)
```
In this example, when a product is deleted, its linked `post` record is also deleted.
In this example, when a product is deleted with [link.delete](https://docs.medusajs.com/learn/fundamentals/module-links/link#cascade-delete-linked-records/index.html.md), all linked blog posts are also deleted.
***