Add isUnique update in query + invalidate cache on rollback (#19746)

Fix isUnique not sent in field update mutation: Added isUnique and
settings to the Pick type in useUpdateOneFieldMetadataItem, which
previously silently dropped these properties from the GraphQL payload.

Invalidate cache on failed migration rollback: Added invalidateCache()
call in the migration runner's catch block so that a failed migration
(e.g., unique index creation failing due to duplicate data) regenerates
the Redis hash, preventing stale metadata from persisting in frontend
localStorage indefinitely. Was
This commit is contained in:
Thomas Trompette
2026-04-16 09:44:59 +02:00
committed by GitHub
parent 6101a4f113
commit 7adab8884b
2 changed files with 14 additions and 0 deletions
@@ -43,10 +43,12 @@ export const useUpdateOneFieldMetadataItem = () => {
| 'description'
| 'icon'
| 'isActive'
| 'isUnique'
| 'label'
| 'name'
| 'defaultValue'
| 'options'
| 'settings'
| 'isLabelSyncedWithName'
>;
}): Promise<
@@ -288,6 +288,18 @@ export class WorkspaceMigrationRunnerService {
);
}
try {
await this.invalidateCache({
allFlatEntityMapsKeys,
workspaceId,
});
} catch (cacheError) {
this.logger.error(
`Cache invalidation failed after rollback: ${cacheError}`,
'Runner',
);
}
if (error instanceof WorkspaceMigrationRunnerException) {
throw error;
}