Skip to content

Commit

Permalink
Show updated row count in migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Bradley committed Dec 1, 2020
1 parent 9f72d23 commit 568e128
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/migrations/4-fix-ttl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ async function* getCorrectedTtls(mapper: DataMapper, model: { new (): any }) {
}

const scanAndFix = async (mapper: DataMapper, model: { new (): any }) => {
let updated = 0;
for await (const _item of mapper.batchPut(getCorrectedTtls(mapper, model))) {
updated++;
if (updated % 100 === 0) {
console.log('Updated ', updated);
}
}
console.log('Updated ', updated);
};

export const fixTtl = async (config: Config) => {
Expand Down

0 comments on commit 568e128

Please # to comment.