-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Record async migration execution time
Needs a migration of existing `migration status` tables to introduce `execution time` column. Change-type: minor Signed-off-by: fisehara <[email protected]>
- Loading branch information
Showing
5 changed files
with
51 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...ixtures/03-async-migrator/01-migrations/migrations/0003-test-migration-execution.async.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { AsyncMigration } from '../../../../../src/migrator/utils'; | ||
|
||
const migration: AsyncMigration = { | ||
asyncFn: async (tx, options) => { | ||
options; | ||
return await tx.executeSql(`SELECT pg_sleep(0.5);`); | ||
}, | ||
asyncBatchSize: 1, | ||
syncFn: async (tx) => { | ||
await tx.executeSql(`SELECT pg_sleep(0.5);`); | ||
}, | ||
delayMS: 1000, | ||
backoffDelayMS: 4000, | ||
errorThreshold: 15, | ||
finalize: false, | ||
}; | ||
|
||
export default migration; |