electron build now waits for the migration before opening the window

This commit is contained in:
zadam 2019-03-31 11:21:44 +02:00
parent 67553cb40e
commit 44551e0e8c

View File

@ -3,6 +3,7 @@
const electron = require('electron'); const electron = require('electron');
const path = require('path'); const path = require('path');
const log = require('./src/services/log'); const log = require('./src/services/log');
const sqlInit = require('./src/services/sql_init');
const cls = require('./src/services/cls'); const cls = require('./src/services/cls');
const url = require("url"); const url = require("url");
const port = require('./src/services/port'); const port = require('./src/services/port');
@ -29,7 +30,13 @@ function onClosed() {
} }
async function createMainWindow() { async function createMainWindow() {
let mainWindowState = windowStateKeeper({ // if schema doesn't exist -> setup process
// if schema exists, then we need to wait until the migration process is finished
if (await sqlInit.schemaExists()) {
await sqlInit.dbReady;
}
const mainWindowState = windowStateKeeper({
// default window width & height so it's usable on 1600 * 900 display (including some extra panels etc.) // default window width & height so it's usable on 1600 * 900 display (including some extra panels etc.)
defaultWidth: 1200, defaultWidth: 1200,
defaultHeight: 800 defaultHeight: 800