From fda657671490639bce2ca9d9f721ceaf5fb5b3fa Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 29 Dec 2021 22:09:56 +0100 Subject: [PATCH] change paths of up, down and reset --- backend/jest.config.js | 1 - backend/package.json | 3 +-- backend/tsconfig.json | 3 +-- database/.env.dist | 1 - database/build/.env.dist | 2 -- database/package.json | 9 +++------ database/src/config/index.ts | 1 - database/src/helpers.ts | 2 +- database/tsconfig.json | 4 +--- 9 files changed, 7 insertions(+), 19 deletions(-) delete mode 100644 database/build/.env.dist diff --git a/backend/jest.config.js b/backend/jest.config.js index 18cf4c2f1..8ef08f580 100644 --- a/backend/jest.config.js +++ b/backend/jest.config.js @@ -7,6 +7,5 @@ module.exports = { moduleNameMapper: { '@entity/(.*)': '/../database/entity/$1', '@dbTools/(.*)': '/../database/src/$1', - '@migrations/(.*)': '/../database/migrations/$1', }, } diff --git a/backend/package.json b/backend/package.json index 9dcb8ec9a..e6f203000 100644 --- a/backend/package.json +++ b/backend/package.json @@ -60,7 +60,6 @@ }, "_moduleAliases": { "@entity": "../database/build/entity", - "@migrations": "../database/migrations", - "@dbTools": "../database/src" + "@dbTools": "../database/build/src" } } diff --git a/backend/tsconfig.json b/backend/tsconfig.json index 9d010b198..eabdc75b0 100644 --- a/backend/tsconfig.json +++ b/backend/tsconfig.json @@ -48,8 +48,7 @@ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ "paths": { /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ "@entity/*": ["../database/entity/*"], - "@dbTools/*": ["../database/src/*"], - "@migrations/*": ["../database/migrations/*"] + "@dbTools/*": ["../database/src/*"] }, // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "typeRoots": [], /* List of folders to include type definitions from. */ diff --git a/database/.env.dist b/database/.env.dist index 644dcaaf4..689e4f509 100644 --- a/database/.env.dist +++ b/database/.env.dist @@ -4,6 +4,5 @@ DB_USER=root DB_PASSWORD= DB_DATABASE=gradido_community MIGRATIONS_TABLE=migrations -MIGRATIONS_DIRECTORY=./migrations/ TYPEORM_SEEDING_FACTORIES=src/factories/**/*{.ts,.js} diff --git a/database/build/.env.dist b/database/build/.env.dist deleted file mode 100644 index 505546e1b..000000000 --- a/database/build/.env.dist +++ /dev/null @@ -1,2 +0,0 @@ -// For production you need to put your env file in here. -// Please copy the dist file from the root folder in here and rename it to .env \ No newline at end of file diff --git a/database/package.json b/database/package.json index 6a061607a..515fbcd74 100644 --- a/database/package.json +++ b/database/package.json @@ -10,9 +10,9 @@ "scripts": { "build": "tsc --build", "clean": "tsc --build --clean", - "up": "cd build && node src/index.js up", - "down": "cd build && node src/index.js down", - "reset": "cd build && node src/index.js reset", + "up": "node build/src/index.js up", + "down": "node build/src/index.js down", + "reset": "node build/src/index.js reset", "dev_up": "ts-node src/index.ts up", "dev_down": "ts-node src/index.ts down", "dev_reset": "ts-node src/index.ts reset", @@ -45,8 +45,5 @@ "ts-mysql-migrate": "^1.0.2", "typeorm": "^0.2.38", "typeorm-seeding": "^1.6.1" - }, - "_moduleAliases": { - "@migrations": "./migrations" } } diff --git a/database/src/config/index.ts b/database/src/config/index.ts index 908d40311..2dde06c96 100644 --- a/database/src/config/index.ts +++ b/database/src/config/index.ts @@ -13,7 +13,6 @@ const database = { const migrations = { MIGRATIONS_TABLE: process.env.MIGRATIONS_TABLE || 'migrations', - MIGRATIONS_DIRECTORY: process.env.MIGRATIONS_DIRECTORY || './migrations/', } const CONFIG = { ...database, ...migrations } diff --git a/database/src/helpers.ts b/database/src/helpers.ts index eba909a3d..710094548 100644 --- a/database/src/helpers.ts +++ b/database/src/helpers.ts @@ -19,7 +19,7 @@ const migration = new Migration({ conn: pool, tableName: CONFIG.MIGRATIONS_TABLE, silent: true, - dir: path.join(__dirname, '..', CONFIG.MIGRATIONS_DIRECTORY), + dir: path.join(__dirname, '..', 'migrations'), }) const initialize = async (): Promise => { diff --git a/database/tsconfig.json b/database/tsconfig.json index f0e707dd2..c2e0ae6c2 100644 --- a/database/tsconfig.json +++ b/database/tsconfig.json @@ -46,9 +46,7 @@ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - "paths": { /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - "@migrations/*": ["./migrations/*"], - }, + // "paths": {} /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ // "rootDirs": [".", "../database"], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */