mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-22 13:57:51 +00:00
add MIGRATE environment variable
This commit is contained in:
@@ -68,6 +68,7 @@ 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) {
|
||||
@@ -85,6 +86,7 @@ Homebrew.count({ tags: '' }, async (err, count)=>{
|
||||
console.log('An error occurred while counting brews with the old schema', err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
schema : HomebrewSchema,
|
||||
|
||||
Reference in New Issue
Block a user