2020-11-01 20:47:47 +00:00
|
|
|
import * as queries from "./queries";
|
|
|
|
import pg from "pg";
|
|
|
|
import db from "./db";
|
|
|
|
|
|
|
|
var versionMajor = 0;
|
2020-11-10 07:04:05 +00:00
|
|
|
var versionMinor = 2;
|
2020-11-10 22:10:08 +00:00
|
|
|
var versionPatch = 1;
|
2020-11-01 20:47:47 +00:00
|
|
|
|
|
|
|
export function getVersion() {
|
|
|
|
return `${versionMajor}.${versionMinor}.${versionPatch}`
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function checkVersion() {
|
|
|
|
var dbver = await db.query(queries.getDbVersion).then((result: pg.QueryResult) => result.rows[0]['get_version']);
|
|
|
|
if (dbver != `${versionMajor}.${versionMinor}`) {
|
|
|
|
throw new Error("Version mismatch!\nApplication version: " + getVersion() + "\nDatabase version: " + dbver)
|
|
|
|
}
|
|
|
|
}
|