Fixed bugs in upgrade logic

This commit is contained in:
rainbow napkin 2026-10-02 20:04:27 -04:00
parent 53746ef743
commit deb50ceff1

View file

@ -35,27 +35,23 @@ module.exports.upgradeCheck = async function(){
//Get the server statistics document from Database
const stats = await statModel.getStats();
//Throw this flag if an upgrade is initiated to automagically and silently initiate all upgrades after it
let upgradeStarted = false;
//If we're upgrading from Panama Red (or older)
if(stats.version == "<0.2.0"){
//Initiate upgrade procedure from Panama Red
await upgradePanamaRed();
//Throw upgrade started flag
upgradeStarted = true;
}
//If we upgraded
if(upgradeStarted){
if(stats.version != package.version){
//Update the statistics document to reflect the new version
stats.version = package.version;
//Write the statistics document to the DB
await stats.save();
//Shout about successfuly upgrade
loggerUtils.consoleShout(`Database Upgrading to ${package.canopyDisplayVersion} Complete!`);
}
loggerUtils.consoleShout(`Database Upgrading to ${package.canopyDisplayVersion} Complete!`);
}
/**