From 7053e1bbc5dd1f25bed23881264862c2ce4e0dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Malfait?= Date: Tue, 7 Apr 2026 09:59:30 +0200 Subject: [PATCH] fix: bypass permission checks in 1.21 backfill-message-thread-subject command (#19375) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - `upgrade:1-21:backfill-message-thread-subject` was failing on every workspace with `Method not allowed because permissions are not implemented at datasource level`. - The global workspace datasource gates raw `query()` calls behind `shouldBypassPermissionChecks`. Both the column-existence probe and the UPDATE in this command now pass that flag, matching the pattern used by the other 1.20/1.21 upgrade commands. ## Test plan - [ ] Re-run `yarn command:prod upgrade:1-21:backfill-message-thread-subject` and confirm all workspaces complete without the permissions error - [ ] Spot-check a workspace to confirm `messageThread.subject` is backfilled from the most recent message 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 --- .../1-21/1-21-backfill-message-thread-subject.command.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/1-21/1-21-backfill-message-thread-subject.command.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/1-21/1-21-backfill-message-thread-subject.command.ts index 8a75ece51e..922d5eb6b7 100644 --- a/packages/twenty-server/src/database/commands/upgrade-version-command/1-21/1-21-backfill-message-thread-subject.command.ts +++ b/packages/twenty-server/src/database/commands/upgrade-version-command/1-21/1-21-backfill-message-thread-subject.command.ts @@ -44,6 +44,8 @@ export class BackfillMessageThreadSubjectCommand extends ActiveOrSuspendedWorksp AND table_name = 'messageThread' AND column_name = 'subject'`, [schemaName], + undefined, + { shouldBypassPermissionChecks: true }, ); if (columnExists.length === 0) { @@ -64,6 +66,9 @@ export class BackfillMessageThreadSubjectCommand extends ActiveOrSuspendedWorksp ) sub WHERE mt.id = sub."messageThreadId" AND mt."subject" IS NULL`, + undefined, + undefined, + { shouldBypassPermissionChecks: true }, ); this.logger.log(