fix: make migrations idempotent, pass checkColumnExists to all migrations

This commit is contained in:
NW
2026-06-25 22:52:59 +01:00
parent a8bf50df24
commit 3deddbc1b1
3 changed files with 5 additions and 11 deletions

View File

@@ -48,11 +48,7 @@ export async function runMigrations() {
for (let i = currentVersion; i < migrations.length; i++) {
logger.info({ migration: i + 1, total: migrations.length }, 'Running migration');
if (i === 1) {
await migrations[i](db, checkColumnExists);
} else {
await migrations[i](db);
}
await migrations[i](db, checkColumnExists);
await db.runAsync(
`INSERT OR REPLACE INTO _meta (key, value) VALUES ('schema_version', ?)`,
[String(i + 1)]