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,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable no-console */
import { Command, flags } from '@oclif/command';
import { Connection, ConnectionOptions, createConnection } from 'typeorm';
import { DataSource as Connection, DataSourceOptions as ConnectionOptions } from 'typeorm';
import { LoggerProxy } from 'n8n-workflow';
import { getLogger } from '@/Logger';
@@ -34,11 +34,12 @@ export class DbRevertMigrationCommand extends Command {
dropSchema: false,
logging: ['query', 'error', 'schema'],
};
connection = await createConnection(connectionOptions);
connection = new Connection(connectionOptions);
await connection.initialize();
await connection.undoLastMigration();
await connection.close();
await connection.destroy();
} catch (error) {
if (connection) await connection.close();
if (connection?.isInitialized) await connection.destroy();
console.error('Error reverting last migration. See log messages for details.');
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument