fix: add missing columns for public directory update

This commit is contained in:
KernelDeimos 2024-06-28 22:26:57 -04:00
parent 88d6bee954
commit b10302ad74
2 changed files with 10 additions and 1 deletions

View File

@ -42,7 +42,7 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService {
this.db = new Database(this.config.path);
// Database upgrade logic
const TARGET_VERSION = 14;
const TARGET_VERSION = 15;
if ( do_setup ) {
this.log.noticeme(`SETUP: creating database at ${this.config.path}`);
@ -63,6 +63,7 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService {
'0014_share.sql',
'0015_group.sql',
'0016_group-permissions.sql',
'0017_publicdirs.sql',
].map(p => path_.join(__dirname, 'sqlite_setup', p));
const fs = require('fs');
for ( const filename of sql_files ) {
@ -135,6 +136,10 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService {
upgrade_files.push('0016_group-permissions.sql');
}
if ( user_version <= 14 ) {
upgrade_files.push('0017_publicdirs.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}`);

View File

@ -0,0 +1,4 @@
ALTER TABLE user ADD COLUMN
"public_uuid" CHAR(36) NULL DEFAULT NULL;
ALTER TABLE user ADD COLUMN
"public_id" INT NULL DEFAULT NULL;