diff --git a/packages/knex/src/schema/SchemaGenerator.ts b/packages/knex/src/schema/SchemaGenerator.ts index d2d46c95945d..26ea662b2841 100644 --- a/packages/knex/src/schema/SchemaGenerator.ts +++ b/packages/knex/src/schema/SchemaGenerator.ts @@ -13,7 +13,6 @@ import { SchemaComparator } from './SchemaComparator'; export class SchemaGenerator extends AbstractSchemaGenerator { private readonly helper = this.platform.getSchemaHelper()!; - private readonly knex = this.connection.getKnex(); private readonly options = this.config.get('schemaGenerator'); /** @deprecated use `dropSchema` and `createSchema` commands respectively */ @@ -586,4 +585,8 @@ export class SchemaGenerator extends AbstractSchemaGenerator return tmp ? tmp + append : ''; } + private get knex() { + return this.connection.getKnex(); + } + } diff --git a/packages/migrations/src/MigrationStorage.ts b/packages/migrations/src/MigrationStorage.ts index 9e60a55ba8e1..589119e58eaa 100644 --- a/packages/migrations/src/MigrationStorage.ts +++ b/packages/migrations/src/MigrationStorage.ts @@ -7,7 +7,6 @@ import type { MigrationRow } from './typings'; export class MigrationStorage implements UmzugStorage { private readonly connection = this.driver.getConnection(); - private readonly knex = this.connection.getKnex(); private readonly helper = this.driver.getPlatform().getSchemaHelper()!; private masterTransaction?: Transaction; @@ -110,4 +109,8 @@ export class MigrationStorage implements UmzugStorage { return { tableName, schemaName }; } + private get knex() { + return this.connection.getKnex(); + } + }