fix: error on schema export

This commit is contained in:
Fabio Di Stasio 2022-07-26 13:33:57 +02:00
parent addd9fba28
commit 1d151e9349
1 changed files with 2 additions and 3 deletions

View File

@ -1,5 +1,4 @@
import * as antares from 'common/interfaces/antares';
import { webContents } from 'electron';
import mysql from 'mysql2/promise';
import * as pg from 'pg';
import SSH2Promise from 'ssh2-promise';
@ -7,8 +6,8 @@ import SSH2Promise from 'ssh2-promise';
const queryLogger = ({ sql, cUid }: {sql: string; cUid: string}) => {
// Remove comments, newlines and multiple spaces
const escapedSql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '').replace(/\s\s+/g, ' ');
if (webContents) {
const mainWindow = webContents.fromId(1);
if (process.type !== undefined) {
const mainWindow = require('electron').webContents.fromId(1);
mainWindow.send('query-log', { cUid, sql: escapedSql, date: new Date() });
}
if (process.env.NODE_ENV === 'development') console.log(escapedSql);