fix: Run every DB migration inside a transaction (#5129)
* always each DB migrations in a transaction * `VACUUM` isn't allowed inside transactions. * `PRAGMA foreign_keys` are automatically toggled before and after every down migration
This commit is contained in:
committed by
GitHub
parent
a573db2ef7
commit
62cce2e518
@@ -57,7 +57,6 @@ export class DeleteExecutionsWithWorkflows1673268682475 implements MigrationInte
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_${tablePrefix}ca4a71b47f28ac6ea88293a8e2" ON "${tablePrefix}execution_entity" ("waitTill")`,
|
||||
);
|
||||
await queryRunner.query(`VACUUM;`);
|
||||
|
||||
await queryRunner.query('PRAGMA foreign_keys=ON');
|
||||
|
||||
@@ -66,7 +65,6 @@ export class DeleteExecutionsWithWorkflows1673268682475 implements MigrationInte
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
const tablePrefix = config.getEnv('database.tablePrefix');
|
||||
await queryRunner.query('PRAGMA foreign_keys=OFF');
|
||||
|
||||
await queryRunner.query(`DROP TABLE IF EXISTS "${tablePrefix}temporary_execution_entity"`);
|
||||
await queryRunner.query(
|
||||
@@ -100,8 +98,5 @@ export class DeleteExecutionsWithWorkflows1673268682475 implements MigrationInte
|
||||
await queryRunner.query(
|
||||
`CREATE INDEX "IDX_${tablePrefix}ca4a71b47f28ac6ea88293a8e2" ON "${tablePrefix}execution_entity" ("waitTill")`,
|
||||
);
|
||||
await queryRunner.query(`VACUUM;`);
|
||||
|
||||
await queryRunner.query('PRAGMA foreign_keys=ON');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user