From 44551e0e8ce4c4205efa525671dd8e05e6a8cf54 Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 31 Mar 2019 11:21:44 +0200 Subject: [PATCH] electron build now waits for the migration before opening the window --- electron.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/electron.js b/electron.js index 427c487b5..798ebde9d 100644 --- a/electron.js +++ b/electron.js @@ -3,6 +3,7 @@ const electron = require('electron'); const path = require('path'); const log = require('./src/services/log'); +const sqlInit = require('./src/services/sql_init'); const cls = require('./src/services/cls'); const url = require("url"); const port = require('./src/services/port'); @@ -29,7 +30,13 @@ function onClosed() { } 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.) defaultWidth: 1200, defaultHeight: 800