Skip to content

Commit f339912

Browse files
committed
Fix rename command error code edge case (#16556)
1 parent 483ef90 commit f339912

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/twenty-server/src/database/commands/upgrade-version-command/1-13/1-13-rename-index.command.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,10 @@ export class RenameIndexNameCommand extends ActiveOrSuspendedWorkspacesMigration
112112
} catch (error) {
113113
await queryRunner.rollbackTransaction();
114114

115-
// PostgreSQL error code 42704: undefined_object (index does not exist)
116-
if (error.code === '42704') {
115+
// PostgreSQL error codes for non-existent index:
116+
// - 42704: undefined_object
117+
// - 42P01: undefined_table (index treated as relation)
118+
if (error.code === '42704' || error.code === '42P01') {
117119
this.logger.log(
118120
`Index ${index.name} does not exist in schema ${schemaName}, removing metadata`,
119121
);
@@ -124,6 +126,9 @@ export class RenameIndexNameCommand extends ActiveOrSuspendedWorkspacesMigration
124126
);
125127
hasRemovedIndexMetadata = true;
126128
} else {
129+
this.logger.error(
130+
`Failed to rename index ${index.name}, error code: ${error.code}`,
131+
);
127132
throw error;
128133
}
129134
} finally {

0 commit comments

Comments
 (0)