fix: make migrations idempotent, pass checkColumnExists to all migrations
This commit is contained in:
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user