mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
fix: error on schema export
This commit is contained in:
@ -1,5 +1,4 @@
|
|||||||
import * as antares from 'common/interfaces/antares';
|
import * as antares from 'common/interfaces/antares';
|
||||||
import { webContents } from 'electron';
|
|
||||||
import mysql from 'mysql2/promise';
|
import mysql from 'mysql2/promise';
|
||||||
import * as pg from 'pg';
|
import * as pg from 'pg';
|
||||||
import SSH2Promise from 'ssh2-promise';
|
import SSH2Promise from 'ssh2-promise';
|
||||||
@ -7,8 +6,8 @@ import SSH2Promise from 'ssh2-promise';
|
|||||||
const queryLogger = ({ sql, cUid }: {sql: string; cUid: string}) => {
|
const queryLogger = ({ sql, cUid }: {sql: string; cUid: string}) => {
|
||||||
// Remove comments, newlines and multiple spaces
|
// Remove comments, newlines and multiple spaces
|
||||||
const escapedSql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '').replace(/\s\s+/g, ' ');
|
const escapedSql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '').replace(/\s\s+/g, ' ');
|
||||||
if (webContents) {
|
if (process.type !== undefined) {
|
||||||
const mainWindow = webContents.fromId(1);
|
const mainWindow = require('electron').webContents.fromId(1);
|
||||||
mainWindow.send('query-log', { cUid, sql: escapedSql, date: new Date() });
|
mainWindow.send('query-log', { cUid, sql: escapedSql, date: new Date() });
|
||||||
}
|
}
|
||||||
if (process.env.NODE_ENV === 'development') console.log(escapedSql);
|
if (process.env.NODE_ENV === 'development') console.log(escapedSql);
|
||||||
|
Reference in New Issue
Block a user