Fixed bugs in upgrade logic
This commit is contained in:
parent
53746ef743
commit
deb50ceff1
1 changed files with 4 additions and 8 deletions
|
|
@ -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!`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue