feat(database): update migration command to use migrateCli and separate migration logic

This commit is contained in:
MythEclipse
2026-05-31 23:10:28 +07:00
parent 7607282db2
commit c2d5bde633
3 changed files with 15 additions and 13 deletions
-12
View File
@@ -52,15 +52,3 @@ export async function runMigrations(): Promise<void> {
throw error;
}
}
if (import.meta.url === `file://${process.argv[1]}`) {
runMigrations()
.then(() => {
logger.info("Migrations completed");
process.exit(0);
})
.catch((error) => {
logger.error({ error }, "Migration failed");
process.exit(1);
});
}
+14
View File
@@ -0,0 +1,14 @@
import { createChildLogger } from "../logger.js";
import { runMigrations } from "./migrate.js";
const logger = createChildLogger("migrate-cli");
runMigrations()
.then(() => {
logger.info("Migrations completed");
process.exit(0);
})
.catch((error) => {
logger.error({ error }, "Migration failed");
process.exit(1);
});