backup before migrating: once per set of pending changes, not on every restart of a crash-looping api

This commit is contained in:
iamdoubz committed 2026-10-21 11:43:24 -05:00
1 parent e2518b03d8
commit 22b3ef9a8c
4 files changed
+48 -16

No files matched your search

+5 -4
View File
@@ -29,10 +29,11 @@ describe.skipIf(!hasTestDb)('migrationsPending', () => {
await rm(newer, { recursive: true, force: true });
});
it('false when up to date, true when the image has more, false for an empty database', async () => {
expect(await migrationsPending(t.db)).toBe(false);
expect(await migrationsPending(t.db, newer)).toBe(true);
it('none when up to date, counts when the image has more, none for an empty database', async () => {
expect(await migrationsPending(t.db)).toBeNull();
const pending = await migrationsPending(t.db, newer);
expect(pending).toEqual({ applied: pending!.total - 1, total: pending!.total });
await t.db.execute(sql`drop schema drizzle cascade`);
expect(await migrationsPending(t.db, newer)).toBe(false);
expect(await migrationsPending(t.db, newer)).toBeNull();
});
});