refactor: Upgrade typeorm to 0.3.x (#5151)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-01-13 18:12:22 +01:00
committed by GitHub
parent 6608e69457
commit 0a5ab560b1
85 changed files with 579 additions and 636 deletions

View File

@@ -1,5 +1,5 @@
import 'tsconfig-paths/register';
import { createConnection } from 'typeorm';
import { DataSource as Connection } from 'typeorm';
import config from '@/config';
import { getBootstrapDBOptions } from './integration/shared/testDb';
@@ -7,7 +7,8 @@ export default async () => {
const dbType = config.getEnv('database.type').replace(/db$/, '');
if (dbType !== 'postgres' && dbType !== 'mysql') return;
const connection = await createConnection(getBootstrapDBOptions(dbType));
const connection = new Connection(getBootstrapDBOptions(dbType));
await connection.initialize();
const query =
dbType === 'postgres' ? 'SELECT datname as "Database" FROM pg_database' : 'SHOW DATABASES';
@@ -20,5 +21,5 @@ export default async () => {
const promises = databases.map((dbName) => connection.query(`DROP DATABASE ${dbName};`));
await Promise.all(promises);
await connection.close();
await connection.destroy();
};