mirror of
https://github.com/HeyPuter/puter.git
synced 2026-05-07 23:50:52 -05:00
Update database version when creating a new one
This commit is contained in:
@@ -41,6 +41,9 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService {
|
|||||||
|
|
||||||
this.db = new Database(this.config.path);
|
this.db = new Database(this.config.path);
|
||||||
|
|
||||||
|
// Database upgrade logic
|
||||||
|
const TARGET_VERSION = 1;
|
||||||
|
|
||||||
if ( do_setup ) {
|
if ( do_setup ) {
|
||||||
this.log.noticeme(`SETUP: creating database at ${this.config.path}`);
|
this.log.noticeme(`SETUP: creating database at ${this.config.path}`);
|
||||||
const sql_files = [
|
const sql_files = [
|
||||||
@@ -55,11 +58,9 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService {
|
|||||||
const contents = fs.readFileSync(filename, 'utf8');
|
const contents = fs.readFileSync(filename, 'utf8');
|
||||||
this.db.exec(contents);
|
this.db.exec(contents);
|
||||||
}
|
}
|
||||||
|
await this.db.exec(`PRAGMA user_version = ${TARGET_VERSION};`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Database upgrade logic
|
|
||||||
const TARGET_VERSION = 1;
|
|
||||||
|
|
||||||
const [{ user_version }] = await this._read('PRAGMA user_version');
|
const [{ user_version }] = await this._read('PRAGMA user_version');
|
||||||
this.log.info('database version: ' + user_version);
|
this.log.info('database version: ' + user_version);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user