From 4f4a13edf5663ab2a042ba3f297e521b1d254fad Mon Sep 17 00:00:00 2001 From: Guillim Date: Mon, 3 Nov 2025 11:50:22 +0100 Subject: [PATCH] switch migrationActionsWithParent to migrationActionsWithParentTmp temporary (#15478) The removal of views from the workspaces schema implies the deletion of ``` view viewFilter viewFilterGroup viewGroup viewSort ``` Before it is created again in the core schema. However, the syncmetadata that executes the pending migration fails because it will try to `query failed: DROP TABLE "workspace_xxxx"."view"` before the removal of the other view related tables that contains a view foreign key with this kind of message > constraint FK_c5ab40cd4debb51d588752a4857 on table "viewField" depends on table view --- .../workspace-migration-runner.service.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 289450c708..d11912680f 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 @@ -67,10 +67,20 @@ export class WorkspaceMigrationRunnerService { `SET LOCAL search_path TO ${schemaName}`, ); + // temporary fix to skip view migrations issue during upgrade 1.8 -> 1.10 + const migrationActionsWithParentTmp = [ + ...migrationActionsWithParent.filter( + ({ tableAction }) => tableAction.name !== 'view', + ), + ...migrationActionsWithParent.filter( + ({ tableAction }) => tableAction.name === 'view', + ), + ]; + for (const { tableAction, parentMigrationId, - } of migrationActionsWithParent) { + } of migrationActionsWithParentTmp) { await this.handleTableChanges( transactionQueryRunner as PostgresQueryRunner, schemaName, @@ -83,7 +93,7 @@ export class WorkspaceMigrationRunnerService { ); } - return migrationActionsWithParent.map((item) => item.tableAction); + return migrationActionsWithParentTmp.map((item) => item.tableAction); } public async executeMigrationFromPendingMigrations(