remove possibility of failing a migration script and then succeeding on later ones
This commit is contained in:
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user