forked from vendure-ecommerce/v2-migration-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
migration.ts
35 lines (30 loc) · 818 Bytes
/
migration.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import {
generateMigration,
revertLastMigration,
runMigrations,
} from "@vendure/core";
import program from "commander";
import { config } from "./src/vendure-config";
program
.command("generate <name>")
.description("Generate a new migration file with the given name")
.action((name) => {
return generateMigration(config, {
name,
outputDir: "./src/migrations",
});
});
program
.command("run")
.description("Run all pending migrations")
.action(() => {
console.log(`running migrations.....`);
return runMigrations(config);
});
program
.command("revert")
.description("Revert the last applied migration")
.action(() => {
return revertLastMigration(config);
});
program.parse(process.argv);