remove possibility of failing a migration script and then succeeding on later ones

This commit is contained in:
2025-05-26 15:50:37 -06:00
parent b8fbc3f7a6
commit 8b7451330f

View File

@@ -54,16 +54,11 @@ export class MigrationService {
// Run pending migrations in order
for (const migration of this.migrations) {
if (!executedMigrations.has(migration.name)) {
try {
await sqlExec(migration.sql);
await sqlExec("INSERT INTO migrations (name) VALUES (?)", [
migration.name,
]);
logger.log(`Migration ${migration.name} executed successfully`);
} catch (error) {
logger.error(`Error executing migration ${migration.name}:`, error);
throw error;
}
await sqlExec(migration.sql);
await sqlExec("INSERT INTO migrations (name) VALUES (?)", [
migration.name,
]);
logger.log(`Migration ${migration.name} executed successfully`);
}
}
}