migration: error checking

This commit is contained in:
mantikoros 2022-04-18 15:53:13 -05:00
parent be314b318f
commit 1f4221bb63

View File

@ -29,6 +29,12 @@ async function recalculateContract(contractRef: DocRef, isCommit = false) {
await firestore.runTransaction(async (transaction) => {
const contractDoc = await transaction.get(contractRef)
const contract = contractDoc.data() as FullContract<DPM, Binary>
if (!contract?.slug) {
console.log('missing slug; id=', contractRef.id)
return
}
console.log('recalculating', contract.slug)
if (
@ -137,7 +143,9 @@ async function main() {
)
for (let contractRef of contractRefs) {
await recalculateContract(contractRef, isCommit)
await recalculateContract(contractRef, isCommit).catch((e) =>
console.log('error: ', e, 'id=', contractRef.id)
)
console.log()
console.log()
}