Compare commits

...
Author SHA1 Message Date
Sonarly Claude Code 432a315f67 fix: move rich text migration from 1-20 to 1-19 upgrade commands
https://sonarly.com/issue/19761?type=bug

After upgrading to v1.19.1, the frontend is completely blank because the GraphQL schema no longer recognizes the `RICH_TEXT_V2` enum value stored in the database, causing all metadata queries to fail.

Fix: Moved `migrateRichTextToTextCommand` into the `'1.19.0'` commands array in `upgrade.command.ts`.

**What changed:** The `MigrateRichTextToTextCommand` (which updates `core.fieldMetadata` rows from `type = 'RICH_TEXT_V2'` to `type = 'RICH_TEXT'`) was only in the 1.20 upgrade bucket. But the code changes that renamed the `FieldMetadataType` enum value from `'RICH_TEXT_V2'` to `'RICH_TEXT'` shipped in v1.19.1. This meant users upgrading to 1.19.x had a GraphQL schema that couldn't serialize the `RICH_TEXT_V2` values still stored in their database.

**The fix:** Add the migration command to `commands_1190` so it runs during the 1.19 upgrade path. It remains in `commands_1200` as well — the command is idempotent because it checks the `IS_RICH_TEXT_V1_MIGRATED` feature flag before executing. If it already ran during 1.19 upgrade, it will skip during 1.20.

**Note for maintainers:** This fix should also be cherry-picked to the `1.19.x` release branch for self-hosted users who are already stuck on v1.19.1/v1.19.2 with a blank frontend. As a workaround, affected users can manually run `npx nx run twenty-server:command upgrade:1-20:migrate-rich-text-to-text` to fix their database.
2026-03-30 21:26:31 +00:00
@@ -78,6 +78,10 @@ export class UpgradeCommand extends UpgradeCommandRunner {
coreMigrationRunnerService,
);
const commands_1190: VersionCommands = [
this.migrateRichTextToTextCommand,
];
const commands_1200: VersionCommands = [
this.identifyPermissionFlagMetadataCommand,
this
@@ -101,7 +105,7 @@ export class UpgradeCommand extends UpgradeCommandRunner {
];
this.allCommands = {
'1.19.0': [],
'1.19.0': commands_1190,
'1.20.0': commands_1200,
};
}