chore(): Throw on migration up/down fail (#13911)
* chore(): Throw on migration up/down fail * Create nine-ways-teach.md
This commit is contained in:
committed by
GitHub
parent
c9701c70da
commit
66bbe39a8e
5
.changeset/nine-ways-teach.md
Normal file
5
.changeset/nine-ways-teach.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/utils": patch
|
||||
---
|
||||
|
||||
chore(): Throw on migration up/down fail
|
||||
@@ -2,6 +2,7 @@ import { LoaderOptions, Logger, ModulesSdkTypes } from "@medusajs/types"
|
||||
import { mikroOrmCreateConnection } from "../../dal"
|
||||
import { loadDatabaseConfig } from "../load-module-database-config"
|
||||
import { Migrations } from "../../migrations"
|
||||
import { MedusaError } from "../../common/errors"
|
||||
|
||||
const TERMINAL_SIZE = process.stdout.columns
|
||||
|
||||
@@ -55,6 +56,11 @@ export function buildRevertMigrationScript({ moduleName, pathToMigrations }) {
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(`Failed with error ${error.message}`, error)
|
||||
throw new MedusaError(
|
||||
MedusaError.Types.DB_ERROR,
|
||||
error.message,
|
||||
error.code
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { LoaderOptions, Logger, ModulesSdkTypes } from "@medusajs/types"
|
||||
import { mikroOrmCreateConnection } from "../../dal"
|
||||
import { loadDatabaseConfig } from "../load-module-database-config"
|
||||
import { Migrations } from "../../migrations"
|
||||
import { MedusaError } from "../../common/errors"
|
||||
|
||||
const TERMINAL_SIZE = process.stdout.columns
|
||||
|
||||
@@ -52,6 +53,7 @@ export function buildMigrationScript({ moduleName, pathToMigrations }) {
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(`Failed with error ${error.message}`, error)
|
||||
throw new MedusaError(MedusaError.Types.DB_ERROR, error.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user