diff --git a/package-lock.json b/package-lock.json index 88db02c9..5ac38fa7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@gravity-ui/expresskit": "^1.2.1", "@gravity-ui/gateway": "^2.0.0", "@gravity-ui/nodekit": "^1.1.1", - "@gravity-ui/postgreskit": "^1.1.1", + "@gravity-ui/postgreskit": "^1.3.0", "ajv": "^6.12.4", "axios": "^1.6.0", "axios-retry": "^3.1.9", @@ -907,9 +907,9 @@ } }, "node_modules/@gravity-ui/postgreskit": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@gravity-ui/postgreskit/-/postgreskit-1.1.1.tgz", - "integrity": "sha512-xt8U6QKtOaflaJOgZn3vnzVBhJaasKsxaMo67uh6ngrnK7Q57A2HN32+xuCo0xhhEiaojOYVP7DM2j3w2OdbdA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@gravity-ui/postgreskit/-/postgreskit-1.3.0.tgz", + "integrity": "sha512-i/OJE/Kb6WRIRNhaqRgTUdy9rSneQ8a51vpoxciNolS3nBc/0Ha2XONoIsUbyCJ3KxF4q47ufEHc5fKUWRR++g==", "dependencies": { "knex": "^2.4.2", "lodash": "^4.17.21", diff --git a/package.json b/package.json index 0ea4e030..fd7813f7 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "@gravity-ui/expresskit": "^1.2.1", "@gravity-ui/gateway": "^2.0.0", "@gravity-ui/nodekit": "^1.1.1", - "@gravity-ui/postgreskit": "^1.1.1", + "@gravity-ui/postgreskit": "^1.3.0", "ajv": "^6.12.4", "axios": "^1.6.0", "axios-retry": "^3.1.9", @@ -59,7 +59,9 @@ "build:test:int": "npm run build && npm run test:int", "test": "npm run build && npm run test:unit && npm run test:int", "db:migrate": "node dist/server/db/scripts/migrate.js", + "db:migrate-one": "node dist/server/db/scripts/migrate-one.js", "db:rollback": "node dist/server/db/scripts/rollback.js", + "db:rollback-one": "node dist/server/db/scripts/rollback-one.js", "console": "node dist/server/console", "prepare-and-test": "rm -rf dist/server && npm run build && npm test", "prepare:db": "npm run build && CI_MODE=true SQL_DEBUG=false DEBUG=false node dist/server/db/scripts/clear-and-prepare", diff --git a/src/db/scripts/migrate-one.ts b/src/db/scripts/migrate-one.ts new file mode 100644 index 00000000..06c54260 --- /dev/null +++ b/src/db/scripts/migrate-one.ts @@ -0,0 +1,13 @@ +require('dotenv').config(); +require('../../index'); +import {helpers} from '../index'; + +helpers + .migrateDatabase({onlyOne: true}) + .then(() => { + process.exit(0); + }) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/src/db/scripts/rollback-one.ts b/src/db/scripts/rollback-one.ts new file mode 100644 index 00000000..08d41c69 --- /dev/null +++ b/src/db/scripts/rollback-one.ts @@ -0,0 +1,13 @@ +require('dotenv').config(); +require('../../index'); +import {helpers} from '../index'; + +helpers + .rollbackDatabase({onlyOne: true}) + .then(() => { + process.exit(0); + }) + .catch((error) => { + console.error(error); + process.exit(1); + });