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:
कारतोफ्फेलस्क्रिप्ट™
2023-01-11 18:29:05 +01:00
committed by GitHub
parent a573db2ef7
commit 62cce2e518
5 changed files with 2 additions and 18 deletions

View File

@@ -132,6 +132,7 @@ export async function init(
synchronize: false,
logging: loggingOption,
maxQueryExecutionTime,
migrationsTransactionMode: 'each',
});
connection = await createConnection(connectionOptions);
@@ -151,9 +152,7 @@ export async function init(
// If you remove this call, remember to turn back on the
// setting to run migrations automatically above.
await connection.runMigrations({
transaction: 'none',
});
await connection.runMigrations();
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
if (migrations.length === 0) {