Finished upgrade logic
This commit is contained in:
parent
d03e221891
commit
0dda73cd14
8 changed files with 230 additions and 32 deletions
|
|
@ -70,14 +70,6 @@ statSchema.statics.getStats = async function(){
|
|||
var stats = await this.findOne({});
|
||||
|
||||
if(stats){
|
||||
//If the current listed version doesnt match current running version
|
||||
if(stats.version != package.version){
|
||||
//Update stat version
|
||||
stats.version = package.version;
|
||||
//Save stat document
|
||||
await stats.save();
|
||||
}
|
||||
|
||||
//If we found something then the statistics document exist and this is it,
|
||||
//So long as no one else has fucked with the database it should be the only one. (is this forshadowing for a future bug?)
|
||||
return stats;
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ tokeCommandSchema.statics.loadDefaults = async function(){
|
|||
if(toke != null){
|
||||
loggerUtils.dumpError(err);
|
||||
}else{
|
||||
loggerUtils.consoleWarn("Error, null toke!");
|
||||
loggerUtils.consoleShout("Error, null toke!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ migrationSchema.statics.ingestLegacyDump = async function(){
|
|||
|
||||
//If we caught an error (most likely it's missing)
|
||||
}catch(err){
|
||||
loggerUtils.consoleWarn("No migration files detected! Pleas provide legacy migration files or disable migration from config.json!");
|
||||
loggerUtils.consoleShout("No migration files detected! Pleas provide legacy migration files or disable migration from config.json!");
|
||||
//BAIL!
|
||||
return;
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ migrationSchema.statics.ingestLegacyDump = async function(){
|
|||
//Pass toke logs over to the stat model for further ingestion
|
||||
await tokeModel.ingestLegacyTokes(tokeLogs);
|
||||
|
||||
loggerUtils.consoleWarn(`Legacy Server Migration Completed at: ${new Date().toLocaleString()}`);
|
||||
loggerUtils.consoleShout(`Legacy Server Migration Completed at: ${new Date().toLocaleString()}`);
|
||||
}catch(err){
|
||||
return loggerUtils.localExceptionHandler(err);
|
||||
}
|
||||
|
|
@ -174,8 +174,8 @@ migrationSchema.statics.ingestLegacyUser = async function(rawProfile){
|
|||
|
||||
//If we have an invalid line
|
||||
if(profileMatches <= 0){
|
||||
loggerUtils.consoleWarn('Bad profile detected in legacy dump:');
|
||||
loggerUtils.consoleWarn(rawProfile);
|
||||
loggerUtils.consoleShout('Bad profile detected in legacy dump:');
|
||||
loggerUtils.consoleShout(rawProfile);
|
||||
//BAIL!
|
||||
return;
|
||||
}
|
||||
|
|
@ -199,8 +199,8 @@ migrationSchema.statics.ingestLegacyUser = async function(rawProfile){
|
|||
|
||||
//If profile array is the wrong length
|
||||
if(profileArray.length != 10){
|
||||
loggerUtils.consoleWarn('Bad profile detected in legacy dump:');
|
||||
loggerUtils.consoleWarn(profileArray);
|
||||
loggerUtils.consoleShout('Bad profile detected in legacy dump:');
|
||||
loggerUtils.consoleShout(profileArray);
|
||||
//BAIL!
|
||||
return;
|
||||
}
|
||||
|
|
@ -212,7 +212,7 @@ migrationSchema.statics.ingestLegacyUser = async function(rawProfile){
|
|||
//If we found the user in the database
|
||||
if(foundMigration != null || foundUser != null){
|
||||
//Scream
|
||||
loggerUtils.consoleWarn(`Found legacy user ${profileArray[1]} in database, skipping migration!`);
|
||||
loggerUtils.consoleShout(`Found legacy user ${profileArray[1]} in database, skipping migration!`);
|
||||
//BAIL!
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue