diff --git a/keyserver/src/database/db-version.js b/keyserver/src/database/db-version.js --- a/keyserver/src/database/db-version.js +++ b/keyserver/src/database/db-version.js @@ -4,11 +4,13 @@ import { dbQuery, SQL } from './database'; +const dbVersionMetadataKey = 'db_version'; + async function fetchDBVersion(): Promise { const versionQuery = SQL` SELECT data FROM metadata - WHERE name = 'db_version'; + WHERE name = ${dbVersionMetadataKey}; `; const [[versionResult]] = await dbQuery(versionQuery); if (!versionResult) { @@ -20,7 +22,7 @@ async function updateDBVersion(dbVersion: number): Promise { const updateQuery = SQL` INSERT INTO metadata (name, data) - VALUES ('db_version', ${dbVersion}) + VALUES (${dbVersionMetadataKey}, ${dbVersion}) ON DUPLICATE KEY UPDATE data = ${dbVersion};