docs: latest fixes (#7951)

This commit is contained in:
Shahed Nasser
2024-07-04 16:28:41 +02:00
committed by GitHub
parent 964927b597
commit 525363630e
2 changed files with 3 additions and 13 deletions
+1 -11
View File
@@ -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"),
},
})
```
<Note title="Important">
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.
</Note>
2. Run the following command in the root directory of your Medusa application:
```bash
@@ -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 modules main service. It will be registered in the Medusa container with that name.
Its key (`helloModuleService`) is the name of the modules 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` packages name.