chore (backend): add script to create new database migrations
This commit is contained in:
parent
bf99167406
commit
0f1323b79d
3 changed files with 18 additions and 4 deletions
|
@ -14,8 +14,8 @@
|
|||
"start:container": "pnpm run gulp && pnpm run migrate && pnpm run start",
|
||||
"start:test": "pnpm --filter backend run start:test",
|
||||
"init": "pnpm run migrate",
|
||||
"migrate": "pnpm --filter backend run migrate",
|
||||
"revertmigration": "pnpm --filter backend run revertmigration",
|
||||
"migrate": "pnpm --filter backend run migration:run",
|
||||
"revertmigration": "pnpm --filter backend run migration:revert",
|
||||
"gulp": "gulp build",
|
||||
"watch": "pnpm run dev",
|
||||
"dev": "pnpm node ./scripts/dev.mjs",
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
"scripts": {
|
||||
"start": "pnpm node ./built/index.js",
|
||||
"start:test": "NODE_ENV=test pnpm node ./built/index.js",
|
||||
"migrate": "typeorm migration:run --dataSource ./built/ormconfig.js",
|
||||
"revertmigration": "typeorm migration:revert --dataSource ./built/ormconfig.js",
|
||||
"migration:run": "typeorm migration:run --dataSource ./built/ormconfig.js",
|
||||
"migration:revert": "typeorm migration:revert --dataSource ./built/ormconfig.js",
|
||||
"migration:new": "pnpm node ./scripts/create-migration.mjs",
|
||||
"check:connect": "node ./check_connect.js",
|
||||
"build": "pnpm swc src --out-dir built --source-maps false --copy-files --strip-leading-paths",
|
||||
"build:debug": "pnpm swc src --out-dir built --source-maps true --copy-files --strip-leading-paths",
|
||||
|
|
13
packages/backend/scripts/create-migration.mjs
Normal file
13
packages/backend/scripts/create-migration.mjs
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { execa } from "execa";
|
||||
|
||||
(async () => {
|
||||
await execa(
|
||||
"pnpm", [
|
||||
"typeorm",
|
||||
"migration:create",
|
||||
`src/migration/${process.argv[2]}`
|
||||
], {
|
||||
stdio: "inherit",
|
||||
},
|
||||
);
|
||||
})();
|
Loading…
Reference in a new issue