From c5d95dc4c84bf9e97e6a89380ecde03dd3f73d76 Mon Sep 17 00:00:00 2001 From: Weiko Date: Fri, 2 Aug 2024 19:13:39 +0200 Subject: [PATCH] Add logs to migration runner (#6518) --- .../src/engine/core-modules/auth/auth.module.ts | 4 ++-- .../workspace-migration-runner.service.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/twenty-server/src/engine/core-modules/auth/auth.module.ts b/packages/twenty-server/src/engine/core-modules/auth/auth.module.ts index 15567f48f2..a734c26946 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/auth.module.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/auth.module.ts @@ -1,6 +1,6 @@ /* eslint-disable no-restricted-imports */ import { HttpModule } from '@nestjs/axios'; -import { Module } from '@nestjs/common'; +import { forwardRef, Module } from '@nestjs/common'; import { JwtModule } from '@nestjs/jwt'; import { TypeOrmModule } from '@nestjs/typeorm'; @@ -54,7 +54,7 @@ const jwtModule = JwtModule.registerAsync({ jwtModule, FileUploadModule, DataSourceModule, - UserModule, + forwardRef(() => UserModule), WorkspaceManagerModule, TypeORMModule, TypeOrmModule.forFeature( diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-runner/workspace-migration-runner.service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-runner/workspace-migration-runner.service.ts index 5c7dd60266..bd5a78ee19 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-migration-runner/workspace-migration-runner.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-migration-runner/workspace-migration-runner.service.ts @@ -9,7 +9,6 @@ import { TableUnique, } from 'typeorm'; -import { WorkspaceCacheVersionService } from 'src/engine/metadata-modules/workspace-cache-version/workspace-cache-version.service'; import { WorkspaceMigrationColumnAction, WorkspaceMigrationColumnActionType, @@ -36,7 +35,6 @@ export class WorkspaceMigrationRunnerService { constructor( private readonly workspaceDataSourceService: WorkspaceDataSourceService, private readonly workspaceMigrationService: WorkspaceMigrationService, - private readonly workspaceCacheVersionService: WorkspaceCacheVersionService, private readonly workspaceMigrationEnumService: WorkspaceMigrationEnumService, private readonly workspaceMigrationTypeService: WorkspaceMigrationTypeService, ) {} @@ -76,6 +74,9 @@ export class WorkspaceMigrationRunnerService { await queryRunner.connect(); await queryRunner.startTransaction(); + // Reset search_path to force to postgres to prefix migrations in the correct schema due to postgres driver behavior + await queryRunner.query('SET search_path TO public'); + const schemaName = this.workspaceDataSourceService.getSchemaName(workspaceId);