chore(): Accept an extra agument 'all-or-nothing' on the migrate command (#14262)

* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* Create rich-camels-brush.md

* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* chore(): Accept an extra agument 'all-or-nothing' on the migrate command

* chore(): fix broken down migrations

* chore(): update changeset
This commit is contained in:
Adrien de Peretti
2025-12-10 09:23:41 +01:00
committed by GitHub
parent 9bcfb990bf
commit 356283c359
13 changed files with 139 additions and 56 deletions

View File

@@ -157,17 +157,15 @@ export class MedusaAppLoader {
* @param action
*/
async runModulesMigrations(
{
moduleNames,
action = "run",
}:
options:
| {
moduleNames?: never
action: "run"
allOrNothing?: boolean
}
| {
moduleNames: string[]
action: "revert" | "generate"
moduleNames: string[]
allOrNothing?: never
} = {
action: "run",
}
@@ -185,14 +183,15 @@ export class MedusaAppLoader {
injectedDependencies,
medusaConfigPath: this.#medusaConfigPath,
cwd: this.#cwd,
allOrNothing: options.allOrNothing,
}
if (action === "revert") {
await MedusaAppMigrateDown(moduleNames!, migrationOptions)
} else if (action === "run") {
if (options.action === "revert") {
await MedusaAppMigrateDown(options.moduleNames!, migrationOptions)
} else if (options.action === "run") {
await MedusaAppMigrateUp(migrationOptions)
} else {
await MedusaAppMigrateGenerate(moduleNames!, migrationOptions)
} else if (options.action === "generate") {
await MedusaAppMigrateGenerate(options.moduleNames!, migrationOptions)
}
}