From 525363630e52603ae817cb928a09cc40865aa19b Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Thu, 4 Jul 2024 17:28:41 +0300 Subject: [PATCH] docs: latest fixes (#7951) --- www/apps/book/app/basics/data-models/page.mdx | 12 +----------- .../book/app/basics/modules-and-services/page.mdx | 4 ++-- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/www/apps/book/app/basics/data-models/page.mdx b/www/apps/book/app/basics/data-models/page.mdx index 8993f5b010..ec2da01a25 100644 --- a/www/apps/book/app/basics/data-models/page.mdx +++ b/www/apps/book/app/basics/data-models/page.mdx @@ -63,24 +63,14 @@ A migration is a class created in a TypeScript or JavaScript file under a module import path from "path" import MyCustom from "./models/my-custom" - export default defineMikroOrmCliConfig({ + export default defineMikroOrmCliConfig("hello", { entities: [MyCustom] as any[], - databaseName: "medusa-hello", migrations: { path: path.join(__dirname, "migrations"), }, }) ``` - - - The `databaseName`'s value is only used to generate the migrations. So, make sure it: - - 1. Is unique to the module. Two modules shouldn't have the same database name, and it shouldn't be the same as the Medusa application. - 2. Doesn't change between migrations, as that causes inconsistencies between the migrations. - - - 2. Run the following command in the root directory of your Medusa application: ```bash diff --git a/www/apps/book/app/basics/modules-and-services/page.mdx b/www/apps/book/app/basics/modules-and-services/page.mdx index 0aa345f14a..8f50f2a95d 100644 --- a/www/apps/book/app/basics/modules-and-services/page.mdx +++ b/www/apps/book/app/basics/modules-and-services/page.mdx @@ -52,7 +52,7 @@ For example, create the file `src/modules/hello/index.ts` with the following con import HelloModuleService from "./service" import { Module } from "@medusajs/utils" -export default Module("hello", { +export default Module("helloModuleService", { service: HelloModuleService, }) ``` @@ -79,7 +79,7 @@ module.exports = defineConfig({ }) ``` -Its key (`helloModuleService`) is the name of the module’s main service. It will be registered in the Medusa container with that name. +Its key (`helloModuleService`) is the name of the module’s main service. It will be registered in the Medusa container with that name. It should also be the same name passed as the first parameter to the `Module` function in the module's definition. Its value is an object having the `resolve` property, whose value is either a path to module's directory relative to `src`(it shouldn't include `src` in the path), or an `npm` package’s name.