core: problem.del, ignore upgrade on fresh install

This commit is contained in:
undefined committed 2021-01-12 23:24:54 +08:00
1 parent 1543a374e3
commit 1d3bdacde9
12 files changed
+66 -119

No files matched your search

+5
View File
@@ -69,9 +69,14 @@ export async function load(call: Entry) {
for (const i of builtinModel) require(`../model/${i}`);
const scripts = require('../upgrade');
let dbVer = (await modelSystem.get('db.ver')) ?? 0;
const isFresh = !dbVer;
const expected = scripts.length;
while (dbVer < expected) {
logger.info('Upgrading database: from %d to %d', dbVer, expected);
if (isFresh) {
const func = scripts[dbVer].toString();
if (func.includes('_FRESH_INSTALL_IGNORE')) continue;
}
const result = await scripts[dbVer]();
if (!result) break;
dbVer++;