Browse Source

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

pull/137/head
Trent Larson 2 weeks ago
parent
commit
8b7451330f
  1. 5
      src/services/migrationService.ts

5
src/services/migrationService.ts

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

Loading…
Cancel
Save