chore: cleanup migrations logs (#7924)
what: when running `medusa run migrations`, cleanup logs with short descriptive message. Before: <img width="1262" alt="Screenshot 2024-07-03 at 14 31 36" src="https://github.com/medusajs/medusa/assets/5105988/504e9c24-371c-476d-9b6d-2dfe1a4088dc"> After: <img width="1004" alt="Screenshot 2024-07-03 at 14 42 57" src="https://github.com/medusajs/medusa/assets/5105988/a89eaed5-04a4-4efb-a2e9-ca480f1eaa6e">
This commit is contained in:
@@ -46,21 +46,23 @@ export function buildMigrationScript({ moduleName, models, pathToMigrations }) {
|
||||
|
||||
try {
|
||||
const migrator = orm.getMigrator()
|
||||
|
||||
const pendingMigrations = await migrator.getPendingMigrations()
|
||||
logger.info(
|
||||
`Running pending migrations: ${JSON.stringify(
|
||||
pendingMigrations,
|
||||
null,
|
||||
2
|
||||
)}`
|
||||
)
|
||||
|
||||
await migrator.up({
|
||||
migrations: pendingMigrations.map((m) => m.name),
|
||||
})
|
||||
if (pendingMigrations.length) {
|
||||
logger.info(
|
||||
`Pending migrations: ${JSON.stringify(pendingMigrations, null, 2)}`
|
||||
)
|
||||
|
||||
logger.info(`${upperCaseFirst(moduleName)} module migration executed`)
|
||||
await migrator.up({
|
||||
migrations: pendingMigrations.map((m) => m.name),
|
||||
})
|
||||
|
||||
logger.info(
|
||||
`${upperCaseFirst(moduleName)} module: ${
|
||||
pendingMigrations.length
|
||||
} migration files executed`
|
||||
)
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
`${upperCaseFirst(
|
||||
|
||||
Reference in New Issue
Block a user