Files
medusa-store/www/apps/book/app/learn/customization/extend-models/page.mdx
Shahed Nasser 0a37675f0e docs: add routing page (#9550)
- Add a new homepage to `book` project for the routing page
- Move all main doc pages to be under `/v2/learn` (and added redirects + fixed links across docs)
- Other: add admin components to resources dropdown + fixes to search on mobile.

Closes DX-955

Preview: https://docs-v2-git-docs-router-page-medusajs.vercel.app/v2
2024-10-18 08:24:34 +00:00

40 lines
1.5 KiB
Plaintext

export const metadata = {
title: `${pageNumber} How to Extend Data Models`,
}
# {metadata.title}
In this chapter, you'll learn about Medusa's alternative approach to extending data models.
## Extend Models Alternative: Module Links
Since modules are isolated from one another, it's not possible to directly extend a module's data models.
Instead, you define a link between the modules' data models.
### Why are Modules Isolated?
Some of the module isolation's benefits include:
- Integrate your module into any Medusa application without side-effects to your setup.
- Replace existing modules with your custom implementation, if your use case is drastically different.
- Use modules in other environments, such as Edge functions and Next.js apps.
### How does Medusa Manage Module Links?
When you define a link, the Medusa application creates a table in the database for it.
Then, when you create a link between two records, the Medusa application stores the IDs of the linked records in that table.
Medusa also provides the necessary tools to manage and query the linked records, which you'll learn about in the next chapters.
---
## Next Chapters: Link Brands to Products Example
The next chapters continue the brands example. It shows you how to:
- Link a brand, which you defined in a [previous example](../custom-features/module/page.mdx), to a product.
- Manage linked records between the brands and products.
- Extend Medusa's Create Product API route to link a product to a brand.
- Query linked brands and products.