From bc7922da7d8e9a374a6c10869747fe1a7847a118 Mon Sep 17 00:00:00 2001
From: Paul Rastoin <45004772+prastoin@users.noreply.github.com>
Date: Fri, 24 Jul 2026 17:32:33 +0200
Subject: [PATCH] fix: move add-agent-foreign-key-to-role-target instance
command to 2.25 (#23285)
## What
Moves the `add-agent-foreign-key-to-role-target` fast instance command
from `2.24.0` to `2.25.0`.
Introduced in #23206, the command was registered under version `2.24.0`.
Since `TWENTY_CURRENT_VERSION` is now `2.25.0`, `2.24.0` is an
already-released version, so its instance commands do not re-run on
upgrade and the foreign-key migration would never execute.
This is the same issue #23271 fixed for the message-list-members
backfill workspace command.
## Changes
- Moved the command file from `upgrade-version-command/2-24/` to `2-25/`
(renamed the file prefix).
- Updated the decorator from `@RegisteredInstanceCommand('2.24.0', ...)`
to `('2.25.0', ...)`.
- Updated the import in `instance-commands.constant.ts` to the new
relative path and reordered both the import and the array entry to sit
after the 2-24 commands.
The timestamp (`1784820332810`) and command logic (`up`/`down`) are
unchanged.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01KpCb9BK1eoM1WWXJU6g95e)_
---
...ast-1784820332810-add-agent-foreign-key-to-role-target.ts} | 2 +-
.../upgrade-version-command/instance-commands.constant.ts | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
rename packages/twenty-server/src/database/commands/upgrade-version-command/{2-24/2-24-instance-command-fast-1784820332810-add-agent-foreign-key-to-role-target.ts => 2-25/2-25-instance-command-fast-1784820332810-add-agent-foreign-key-to-role-target.ts} (95%)
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/2-24/2-24-instance-command-fast-1784820332810-add-agent-foreign-key-to-role-target.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/2-25/2-25-instance-command-fast-1784820332810-add-agent-foreign-key-to-role-target.ts
similarity index 95%
rename from packages/twenty-server/src/database/commands/upgrade-version-command/2-24/2-24-instance-command-fast-1784820332810-add-agent-foreign-key-to-role-target.ts
rename to packages/twenty-server/src/database/commands/upgrade-version-command/2-25/2-25-instance-command-fast-1784820332810-add-agent-foreign-key-to-role-target.ts
index 3cbf6180ca..e09eca1240 100644
--- a/packages/twenty-server/src/database/commands/upgrade-version-command/2-24/2-24-instance-command-fast-1784820332810-add-agent-foreign-key-to-role-target.ts
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/2-25/2-25-instance-command-fast-1784820332810-add-agent-foreign-key-to-role-target.ts
@@ -3,7 +3,7 @@ import { type QueryRunner } from 'typeorm';
import { RegisteredInstanceCommand } from 'src/engine/core-modules/upgrade/decorators/registered-instance-command.decorator';
import { type FastInstanceCommand } from 'src/engine/core-modules/upgrade/interfaces/fast-instance-command.interface';
-@RegisteredInstanceCommand('2.24.0', 1784820332810)
+@RegisteredInstanceCommand('2.25.0', 1784820332810)
export class AddAgentForeignKeyToRoleTargetFastInstanceCommand implements FastInstanceCommand {
public async up(queryRunner: QueryRunner): Promise {
await queryRunner.query(
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts
index 7ab2c46eb0..1fb5efbba7 100644
--- a/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/instance-commands.constant.ts
@@ -122,8 +122,8 @@ import { BackfillCreatedWorkspaceActivationStatusSlowInstanceCommand } from './2
import { UnlistUnclaimedNpmApplicationRegistrationsSlowInstanceCommand } from './2-23/2-23-instance-command-slow-1784322591746-unlist-unclaimed-npm-application-registrations';
import { AddStatusesToBillingSubscriptionIndexSlowInstanceCommand } from './2-23/2-23-instance-command-slow-1784650048045-add-statuses-to-billing-subscription-index';
import { AddOnConnectLogicFunctionToConnectionProviderFastInstanceCommand } from './2-24/2-24-instance-command-fast-1784712843602-add-on-connect-logic-function-to-connection-provider';
-import { AddAgentForeignKeyToRoleTargetFastInstanceCommand } from 'src/database/commands/upgrade-version-command/2-24/2-24-instance-command-fast-1784820332810-add-agent-foreign-key-to-role-target';
import { RepairKeyValuePairApplicationIdFastInstanceCommand } from './2-24/2-24-instance-command-fast-1784897347051-repair-key-value-pair-application-id';
+import { AddAgentForeignKeyToRoleTargetFastInstanceCommand } from './2-25/2-25-instance-command-fast-1784820332810-add-agent-foreign-key-to-role-target';
export const INSTANCE_COMMANDS = [
AddViewFieldGroupIdIndexOnViewFieldFastInstanceCommand,
@@ -248,6 +248,6 @@ export const INSTANCE_COMMANDS = [
AddLogoFileIdToApplicationRegistration2_23FastInstanceCommand,
AddStatusesToBillingSubscriptionIndexSlowInstanceCommand,
AddOnConnectLogicFunctionToConnectionProviderFastInstanceCommand,
- AddAgentForeignKeyToRoleTargetFastInstanceCommand,
RepairKeyValuePairApplicationIdFastInstanceCommand,
+ AddAgentForeignKeyToRoleTargetFastInstanceCommand,
];