mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
core: problem.del, ignore upgrade on fresh install
This commit is contained in:
1 parent
1543a374e3
commit
1d3bdacde9
12 files changed
+66
-119
No files matched your search
@@ -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++;
|
||||
|
||||
Reference in new issue
Block a user