From 4078a63fe1707ed5571387bf995247a113f44ee2 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Sun, 7 Jul 2024 23:16:19 -0400 Subject: [PATCH] tweak: maximize dev center on start --- .../src/services/database/SqliteDatabaseAccessService.js | 7 ++++++- .../services/database/sqlite_setup/0022_dev-center-max.sql | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 src/backend/src/services/database/sqlite_setup/0022_dev-center-max.sql diff --git a/src/backend/src/services/database/SqliteDatabaseAccessService.js b/src/backend/src/services/database/SqliteDatabaseAccessService.js index f920df1e..7472d157 100644 --- a/src/backend/src/services/database/SqliteDatabaseAccessService.js +++ b/src/backend/src/services/database/SqliteDatabaseAccessService.js @@ -42,7 +42,7 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService { this.db = new Database(this.config.path); // Database upgrade logic - const TARGET_VERSION = 19; + const TARGET_VERSION = 20; if ( do_setup ) { this.log.noticeme(`SETUP: creating database at ${this.config.path}`); @@ -68,6 +68,7 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService { '0019_fix-0016.sql', '0020_dev-center.sql', '0021_app-owner-id.sql', + '0022_dev-center-max.sql', ].map(p => path_.join(__dirname, 'sqlite_setup', p)); const fs = require('fs'); for ( const filename of sql_files ) { @@ -160,6 +161,10 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService { upgrade_files.push('0021_app-owner-id.sql'); } + if ( user_version <= 19 ) { + upgrade_files.push('0022_dev-center-max.sql'); + } + if ( upgrade_files.length > 0 ) { this.log.noticeme(`Database out of date: ${this.config.path}`); this.log.noticeme(`UPGRADING DATABASE: ${user_version} -> ${TARGET_VERSION}`); diff --git a/src/backend/src/services/database/sqlite_setup/0022_dev-center-max.sql b/src/backend/src/services/database/sqlite_setup/0022_dev-center-max.sql new file mode 100644 index 00000000..8aec8354 --- /dev/null +++ b/src/backend/src/services/database/sqlite_setup/0022_dev-center-max.sql @@ -0,0 +1,4 @@ +-- fixing owner IDs for default apps; +-- they should all be owned by 'default_user' + +UPDATE `apps` SET `maximize_on_start`=1 WHERE `uid`='app-0b37f054-07d4-4627-8765-11bd23e889d4';