0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-31 15:12:39 +00:00

remove migration in favor of as-edited approach

This commit is contained in:
Charlie Humphreys
2022-06-25 00:43:47 -05:00
parent 8ee832e633
commit c7cfa86205
5 changed files with 6 additions and 24 deletions

View File

@@ -68,26 +68,6 @@ HomebrewSchema.statics.getByUser = function(username, allowAccess=false, fields=
const Homebrew = mongoose.model('Homebrew', HomebrewSchema);
if(process.env.MIGRATE === 'true') {
Homebrew.count({ tags: '' }, async (err, count)=>{
if(!err) {
if(count > 0) {
Homebrew.updateMany({ tags: '' }, { tags: [] }, { multi: true }, function(err, data) {
if(!err) {
console.log('Successfully updated all brews to new schema definition');
} else {
console.log('An error occurred while updating brews to the new schema', err);
}
});
} else {
console.log('No brews to update');
}
} else {
console.log('An error occurred while counting brews with the old schema', err);
}
});
}
module.exports = {
schema : HomebrewSchema,
model : Homebrew,