Remove viewGroup.fieldMetadataId#16571
Merged
charlesBochet merged 5 commits intomainfrom Dec 15, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Contributor
There was a problem hiding this comment.
1 issue found across 20 files
Prompt for AI agents (all 1 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/twenty-server/src/database/typeorm/core/migrations/common/1765808791153-remove-field-metadata-id-in-view-group.ts">
<violation number="1" location="packages/twenty-server/src/database/typeorm/core/migrations/common/1765808791153-remove-field-metadata-id-in-view-group.ts:19">
P2: The `down` migration adds `fieldMetadataId` as `NOT NULL` without a default value. If any rows exist in `viewGroup` when rolling back, this will fail. Consider making the column nullable in the rollback, or adding a comment explaining the rollback limitation.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
|
|
||
| public async down(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query( | ||
| `ALTER TABLE "core"."viewGroup" ADD "fieldMetadataId" uuid NOT NULL`, |
Contributor
There was a problem hiding this comment.
P2: The down migration adds fieldMetadataId as NOT NULL without a default value. If any rows exist in viewGroup when rolling back, this will fail. Consider making the column nullable in the rollback, or adding a comment explaining the rollback limitation.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/twenty-server/src/database/typeorm/core/migrations/common/1765808791153-remove-field-metadata-id-in-view-group.ts, line 19:
<comment>The `down` migration adds `fieldMetadataId` as `NOT NULL` without a default value. If any rows exist in `viewGroup` when rolling back, this will fail. Consider making the column nullable in the rollback, or adding a comment explaining the rollback limitation.</comment>
<file context>
@@ -0,0 +1,25 @@
+
+ public async down(queryRunner: QueryRunner): Promise<void> {
+ await queryRunner.query(
+ `ALTER TABLE "core"."viewGroup" ADD "fieldMetadataId" uuid NOT NULL`,
+ );
+ await queryRunner.query(
</file context>
✅ Addressed in fb13a7d
Comment on lines
78
to
88
|
|
||
| const { flatViewMaps } = | ||
| await this.flatEntityMapsCacheService.getOrRecomputeManyOrAllFlatEntityMaps( | ||
| { | ||
| workspaceId, | ||
| flatMapsKeys: ['flatViewMaps'], | ||
| }, | ||
| ); | ||
|
|
||
| const flatViewGroupsToCreate = createViewGroupInputs.map( | ||
| (createViewGroupInput) => { | ||
| const mainGroupByFieldMetadataId = | ||
| flatViewMaps.byId[createViewGroupInput.viewId] | ||
| ?.mainGroupByFieldMetadataId; | ||
|
|
||
| if (!isDefined(mainGroupByFieldMetadataId)) { | ||
| throw new ViewGroupException( | ||
| 'The associated view is not a grouped view: mainGroupByFieldMetadataId is missing.', | ||
| ViewGroupExceptionCode.MISSING_MAIN_GROUP_BY_FIELD_METADATA_ID, | ||
| ); | ||
| } | ||
|
|
||
| return fromCreateViewGroupInputToFlatViewGroupToCreate({ | ||
| (createViewGroupInput) => | ||
| fromCreateViewGroupInputToFlatViewGroupToCreate({ | ||
| createViewGroupInput, | ||
| workspaceId, | ||
| workspaceCustomApplicationId: workspaceCustomFlatApplication.id, | ||
| mainGroupByFieldMetadataId, | ||
| }); | ||
| }, | ||
| }), | ||
| ); | ||
|
|
||
| const validateAndBuildResult = |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Final step of twentyhq/core-team-issues#1965
Removing viewGroup.fieldMetadataId.
It's already not used in FE anymore