From 66d1afbb81e8c3dbf3a0d46913feac43188094e3 Mon Sep 17 00:00:00 2001 From: Dragory Date: Sat, 15 Dec 2018 16:29:38 +0200 Subject: [PATCH] ormconfig: fix slow cli commands; add db timeout For some reason, absolute paths to migrations and/or entities caused the cli to freeze/load indefinitely when trying to create migrations. --- ormconfig.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ormconfig.js b/ormconfig.js index 64420297..9b7d0b1d 100644 --- a/ormconfig.js +++ b/ormconfig.js @@ -6,12 +6,12 @@ const moment = require('moment-timezone'); moment.tz.setDefault('UTC'); const entities = process.env.NODE_ENV === 'production' - ? path.resolve(__dirname, 'dist/data/entities/*.js') - : path.resolve(__dirname, 'src/data/entities/*.ts'); + ? path.relative(process.cwd(), path.resolve(__dirname, 'dist/data/entities/*.js')) + : path.relative(process.cwd(), path.resolve(__dirname, 'src/data/entities/*.ts')); const migrations = process.env.NODE_ENV === 'production' - ? path.resolve(__dirname, 'dist/migrations/*.js') - : path.resolve(__dirname, 'src/migrations/*.ts'); + ? path.relative(process.cwd(), path.resolve(__dirname, 'dist/migrations/*.js')) + : path.relative(process.cwd(), path.resolve(__dirname, 'src/migrations/*.ts')); module.exports = { type: "mysql", @@ -24,6 +24,7 @@ module.exports = { bigNumberStrings: true, dateStrings: true, synchronize: false, + connectTimeout: 2000, // Entities entities: [entities],