Skip to content

Commit

Permalink
Merge pull request #360 from razee-io/migration_fix
Browse files Browse the repository at this point in the history
fix migration code
  • Loading branch information
dalehille committed Aug 4, 2020
2 parents d0f8a7d + accf7d8 commit 8148973
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions imports/startup/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,16 @@ const migrateUserOrgs = () => {
let userOrgs;
if(userDoc.github && userDoc.github.orgs) {
userOrgs = userDoc.github.orgs;
} else {
} else if(userDoc.bitbucket && userDoc.bitbucket.teams) {
userOrgs = userDoc.bitbucket.teams;
}
try{
Meteor.users.update({'_id': userDoc._id}, { $set: { 'orgs': userOrgs} });
} catch (error){
log.error(error);

if(userOrgs) {
try{
Meteor.users.update({'_id': userDoc._id}, { $set: { 'orgs': userOrgs} });
} catch (error){
log.error(error);
}
}
});
};
Expand Down

0 comments on commit 8148973

Please sign in to comment.