mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-08 12:37:00 +03:00
Change the version code to be the last run upgrade file.
This commit is contained in:
@@ -29,14 +29,12 @@ if (!config.readOnly) {
|
|||||||
let versionCodeInfo = db.prepare("SELECT value FROM config WHERE key = ?").get("version");
|
let versionCodeInfo = db.prepare("SELECT value FROM config WHERE key = ?").get("version");
|
||||||
let versionCode = versionCodeInfo ? versionCodeInfo.value : 0;
|
let versionCode = versionCodeInfo ? versionCodeInfo.value : 0;
|
||||||
|
|
||||||
console.log(versionCode)
|
let path = config.schemaFolder + "/_upgrade_" + (versionCode + 1) + ".sql";
|
||||||
|
|
||||||
let path = config.schemaFolder + "/_upgrade_" + versionCode + ".sql";
|
|
||||||
while (fs.existsSync(path)) {
|
while (fs.existsSync(path)) {
|
||||||
db.exec(fs.readFileSync(path).toString());
|
db.exec(fs.readFileSync(path).toString());
|
||||||
|
|
||||||
versionCode = db.prepare("SELECT value FROM config WHERE key = ?").get("version").value;
|
versionCode = db.prepare("SELECT value FROM config WHERE key = ?").get("version").value;
|
||||||
path = config.schemaFolder + "/_upgrade_" + versionCode + ".sql";
|
path = config.schemaFolder + "/_upgrade_" + (versionCode + 1) + ".sql";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user