Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add delete view fields without views command #8728

Merged
merged 5 commits into from
Nov 26, 2024

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Nov 25, 2024

Context

We recently added a command to ensure uniqueness on the viewId column in the viewField table. This created some issues for some old workspaces that had viewFields with an empty viewId.
This command should get rid of those and set the column as non-nullable.
Also updating the onDelete action accordingly and set one missing for FavoriteFolder

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR adds commands to clean up orphaned view fields and enforce data integrity constraints, focusing on making viewId non-nullable and updating cascade behaviors.

Key changes:

  • Added DeleteViewFieldsWithoutViewsCommand to remove view fields with null viewId
  • Changed onDelete action from SET_NULL to CASCADE for viewFields in ViewWorkspaceEntity
  • Added unique index on [fieldMetadataId, viewId] in ViewFieldWorkspaceEntity
  • Added onDelete: SET_NULL action for favorites relation in FavoriteFolderWorkspaceEntity
  • Made viewId field non-nullable in ViewFieldWorkspaceEntity

8 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +38 to +42
await this.deleteViewFieldsWithoutViewsCommand.executeActiveWorkspacesCommand(
passedParam,
options,
workspaceIds,
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider adding error handling here to prevent upgrade failure if view field cleanup fails

@charlesBochet charlesBochet merged commit a16b0d2 into main Nov 26, 2024
19 checks passed
@charlesBochet charlesBochet deleted the c--add-delete-view-fields-without-views branch November 26, 2024 09:40
Weiko added a commit that referenced this pull request Nov 26, 2024
## Context
We recently added a command to ensure uniqueness on the viewId column in
the viewField table. This created some issues for some old workspaces
that had viewFields with an empty viewId.
This command should get rid of those and set the column as non-nullable.
Also updating the onDelete action accordingly and set one missing for
FavoriteFolder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants