fixup! Refactored migration to run faster

This commit is contained in:
Fabien O'Carroll 2021-09-17 13:46:19 +02:00 committed by Daniel Lockyer
parent 484e0c1e05
commit 3165315f84

View File

@ -19,6 +19,11 @@ module.exports = createTransactionalMigration(
)
.where('members.status', 'free');
if (freeMemberEvents.length === 0) {
logging.info('No free members found - skipping migration');
return;
}
const eventsByMember = _.groupBy(freeMemberEvents, 'member_id');
const eventsToUpdate = Object.keys(eventsByMember).reduce((incorrectEvents, memberId) => {