diff --git a/keyserver/src/database/migration-config.js b/keyserver/src/database/migration-config.js --- a/keyserver/src/database/migration-config.js +++ b/keyserver/src/database/migration-config.js @@ -26,6 +26,7 @@ }, ], ]); +const newDatabaseVersion: number = Math.max(...migrations.keys()); async function makeSureBaseRoutePathExists(filePath: string): Promise { let readFile, json; @@ -82,4 +83,4 @@ await writeFile.close(); } -export { migrations }; +export { migrations, newDatabaseVersion }; diff --git a/keyserver/src/database/setup-db.js b/keyserver/src/database/setup-db.js --- a/keyserver/src/database/setup-db.js +++ b/keyserver/src/database/setup-db.js @@ -10,12 +10,15 @@ import { createThread } from '../creators/thread-creator'; import { dbQuery, SQL } from '../database/database'; +import { updateDBVersion } from '../database/db-version'; +import { newDatabaseVersion } from '../database/migration-config'; import { createScriptViewer } from '../session/scripts'; async function setupDB() { await createTables(); await createUsers(); await createThreads(); + await setUpMetaTable(); } async function createTables() { @@ -397,4 +400,8 @@ ); } +async function setUpMetaTable() { + await updateDBVersion(newDatabaseVersion); +} + export { setupDB };