docs: add guide on how to seed data (#9449)
Add a guide on how to seed data using a custom CLI script, with an example to seed products Closes DOCS-953
This commit is contained in:
@@ -36,7 +36,7 @@ export const methodsHighlight = [
|
||||
// other imports...
|
||||
import {
|
||||
InjectManager,
|
||||
MedusaContext
|
||||
MedusaContext,
|
||||
} from "@medusajs/framework/utils"
|
||||
|
||||
class HelloModuleService {
|
||||
@@ -99,7 +99,7 @@ export const opHighlights = [
|
||||
import {
|
||||
InjectManager,
|
||||
InjectTransactionManager,
|
||||
MedusaContext
|
||||
MedusaContext,
|
||||
} from "@medusajs/framework/utils"
|
||||
import { Context } from "@medusajs/framework/types"
|
||||
import { EntityManager } from "@mikro-orm/knex"
|
||||
@@ -118,10 +118,10 @@ class HelloModuleService {
|
||||
await transactionManager.nativeUpdate(
|
||||
"my_custom",
|
||||
{
|
||||
id: input.id
|
||||
id: input.id,
|
||||
},
|
||||
{
|
||||
name: input.name
|
||||
name: input.name,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -307,7 +307,7 @@ export const repoHighlights = [
|
||||
import {
|
||||
InjectManager,
|
||||
InjectTransactionManager,
|
||||
MedusaContext
|
||||
MedusaContext,
|
||||
} from "@medusajs/framework/utils"
|
||||
import { Context } from "@medusajs/framework/types"
|
||||
import { EntityManager } from "@mikro-orm/knex"
|
||||
@@ -327,10 +327,10 @@ class HelloModuleService {
|
||||
await transactionManager.nativeUpdate(
|
||||
"my_custom",
|
||||
{
|
||||
id: input.id
|
||||
id: input.id,
|
||||
},
|
||||
{
|
||||
name: input.name
|
||||
name: input.name,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -342,7 +342,7 @@ class HelloModuleService {
|
||||
return updatedRecord
|
||||
},
|
||||
{
|
||||
transaction: sharedContext.transactionManager
|
||||
transaction: sharedContext.transactionManager,
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -397,7 +397,7 @@ class HelloModuleService {
|
||||
// ...
|
||||
},
|
||||
{
|
||||
transaction: sharedContext.transactionManager
|
||||
transaction: sharedContext.transactionManager,
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -430,7 +430,7 @@ class HelloModuleService {
|
||||
// ...
|
||||
},
|
||||
{
|
||||
isolationLevel: IsolationLevel.READ_COMMITTED
|
||||
isolationLevel: IsolationLevel.READ_COMMITTED,
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -456,7 +456,7 @@ class HelloModuleService {
|
||||
// ...
|
||||
},
|
||||
{
|
||||
enableNestedTransactions: false
|
||||
enableNestedTransactions: false,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user