Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 8a1f2d6

Browse files
Update migration script to be able to run multiple times
1 parent ce31f7d commit 8a1f2d6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/scripts/migrations/008-fix-copilot-payments.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const config = require('config')
77
const _ = require('lodash')
88
const logger = require('../../util/logger')
99
const challengeIfxService = require('../../services/challengeInformixService')
10+
const challengeService = require('../../services/challengeService')
1011
const { getESClient } = require('../../util/helper')
1112

1213
const migrationFunction = {
@@ -34,6 +35,8 @@ const migrationFunction = {
3435
} else {
3536
await challengeIfxService.createCopilotPaymentInIfx(legacyId, copilotPayment, challenge.createdBy)
3637
}
38+
challenge.legacy.migration = 8
39+
challengeService.save(challenge)
3740
}
3841
} else {
3942
finish = true
@@ -57,6 +60,11 @@ async function getChallengesMissingData (page = 0, perPage = 10) {
5760
exists: {
5861
field: 'prizeSets'
5962
}
63+
},
64+
must_not: {
65+
match_phrase: {
66+
'legacy.migration': 8
67+
}
6068
}
6169
}
6270
}

0 commit comments

Comments
 (0)