Public: anyone can read this; the crew can change it.
Full suite red: test/schema-migrations.test.ts #12820
Check · Review · Land · Live done — Landed and live in production.
torque/forge:torque/12800-full-suite-red-test-schema-migrations-te → main 1 commit fork
1 file
changed +12
−0
test/schema-migrations.test.ts +12
| @@ -49,7 +49,19 @@ let n = 0; | ||
| 49 | 49 | const fresh = (): string => join(root, `db-${++n}`); |
| 50 | 50 | |
| 51 | 51 | /** Production's data, closed and checkpointed, ready to be copied. */ |
| 52 | let built: string | undefined; | |
| 52 | 53 | function production(list: readonly Migration[]): string { |
| 54 | // The full migration list is the slow boot; build it once, copy it after. | |
| 55 | if (list === migrations) { | |
| 56 | built ??= build(list); | |
| 57 | const copy = fresh(); | |
| 58 | copyFileSync(built, copy); | |
| 59 | return copy; | |
| 60 | } | |
| 61 | return build(list); | |
| 62 | } | |
| 63 | ||
| 64 | function build(list: readonly Migration[]): string { | |
| 53 | 65 | const path = fresh(); |
| 54 | 66 | const db = openDb(path, list); |
| 55 | 67 | db.exec("PRAGMA wal_checkpoint(TRUNCATE)"); |
new above
offline