mirror of
https://github.com/HeyPuter/puter.git
synced 2025-01-23 22:40:20 +08:00
fix: database migration
This commit is contained in:
parent
6d1c1d3ed2
commit
9b39309e18
@ -42,7 +42,7 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService {
|
||||
this.db = new Database(this.config.path);
|
||||
|
||||
// Database upgrade logic
|
||||
const TARGET_VERSION = 9;
|
||||
const TARGET_VERSION = 10;
|
||||
|
||||
if ( do_setup ) {
|
||||
this.log.noticeme(`SETUP: creating database at ${this.config.path}`);
|
||||
@ -57,6 +57,8 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService {
|
||||
'0008_otp.sql',
|
||||
'0009_app-prefix-fix.sql',
|
||||
'0010_add-git-app.sql',
|
||||
'0011_notification.sql',
|
||||
'0012_appmetadata.sql',
|
||||
].map(p => path_.join(__dirname, 'sqlite_setup', p));
|
||||
const fs = require('fs');
|
||||
for ( const filename of sql_files ) {
|
||||
@ -109,6 +111,10 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService {
|
||||
upgrade_files.push('0011_notification.sql');
|
||||
}
|
||||
|
||||
if ( user_version <= 9 ) {
|
||||
upgrade_files.push('0012_appmetadata.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}`);
|
||||
|
Loading…
Reference in New Issue
Block a user