Chg: tsxをdevDependenciesに移動 / Del: MikroORM公式CLIを廃止 / Feat: scriptsのmigrator
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import config from "../dist/mikro-orm.config.js";
|
||||
import { MikroORM } from "@mikro-orm/postgresql";
|
||||
|
||||
const orm = await MikroORM.init({
|
||||
...config,
|
||||
logger: (msg) => console.log(msg),
|
||||
});
|
||||
|
||||
switch (process.argv[2]) {
|
||||
case "up":
|
||||
await orm.migrator.up();
|
||||
break;
|
||||
case "down":
|
||||
await orm.migrator.down();
|
||||
break;
|
||||
case "create":
|
||||
await orm.migrator.createMigration();
|
||||
break;
|
||||
default:
|
||||
console.log("Only the options up, down, and create are available.");
|
||||
}
|
||||
|
||||
process.exit();
|
||||
Reference in New Issue
Block a user