Files
twenty/packages
Sonarly Claude Code b709da5825 fix: keep RICH_TEXT_V2 DB value in FieldMetadataType enum for v1.19.x compatibility
https://sonarly.com/issue/17827?type=bug

Frontend is completely broken on v1.19.1 because the FieldMetadataType GraphQL enum no longer accepts the RICH_TEXT_V2 value still stored in the database, causing all metadata queries to fail.

Fix: ## Fix: Restore RICH_TEXT_V2 as the enum value for FieldMetadataType.RICH_TEXT

The core issue is that commit `d9eb317bb5` changed `RICH_TEXT = 'RICH_TEXT_V2'` to `RICH_TEXT = 'RICH_TEXT'`, despite claiming to "keep the DB value." This caused the GraphQL enum (built via `registerEnumType`) to only accept `RICH_TEXT`, while the database still stores `RICH_TEXT_V2`.

### Changes:

1. **`packages/twenty-shared/src/types/FieldMetadataType.ts`** — Restored the enum value from `'RICH_TEXT'` to `'RICH_TEXT_V2'`. This is the single-line fix that resolves the GraphQL serialization error. The GraphQL schema will now correctly accept `RICH_TEXT_V2` values from the database.

2. **`packages/twenty-server/src/database/commands/upgrade-version-command/1-20/1-20-migrate-rich-text-to-text.command.ts`** — Removed the `RICH_TEXT_V2 → RICH_TEXT` rename SQL since the DB value should remain `RICH_TEXT_V2`. The command now only handles migrating deprecated V1 `RICH_TEXT` fields to `TEXT`.

3. **`packages/twenty-server/src/engine/workspace-manager/workspace-migration/workspace-migration-runner/utils/is-text-column-type.util.ts`** — Replaced `(type as string) === 'RICH_TEXT_V2'` with `type === FieldMetadataType.RICH_TEXT` since the enum value now correctly matches the DB value. The raw string fallback for `'RICH_TEXT'` (V1) is kept for pre-upgrade compatibility.

### Follow-up required:
- Run `npx nx run twenty-front:graphql:generate` and `npx nx run twenty-front:graphql:generate --configuration=metadata` to regenerate GraphQL types
- After codegen, update `CompositeFieldType.ts` and `assertFieldMetadata.ts` to use `'RICH_TEXT_V2'` string literals (they currently use `'RICH_TEXT'` to match the generated enum)
- Rebuild `twenty-shared` before other packages
2026-03-24 10:02:48 +00:00
..
2026-03-17 11:43:17 +01:00
2026-03-23 16:56:15 +00:00