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

feat: workspace health target column map fix #3932

Merged
merged 7 commits into from
Feb 15, 2024

Conversation

magrinj
Copy link
Member

@magrinj magrinj commented Feb 13, 2024

This PR is implementing the target-column-map kind in the --fix option of workspace:health command.
The core was created here #3863

Fix #3844

@magrinj magrinj marked this pull request as ready for review February 13, 2024 14:53
@magrinj magrinj force-pushed the feat/workspace-health-target-colulmn-map-fix branch from 7baec25 to 1127315 Compare February 13, 2024 15:10
Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

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

@magrinj I think the refactoring makes sense.

I've tested and these are my feedbacks:

  • default-value doesn't seem to work anymore. I've removed the defaultValue on a text field and it was not detected
  • regarding targetColumnMap, the following cases are not handled:
  1. wrong columnName { "value": "_columnId" } instead of { "value": "columnId" } + rename the column if the column is badly named
  2. wrong columnName { "value": "sdlkjfls" } instead of { "value": "columnId" } + rename the column in postgres schema if the column is badly named
  3. targetColumnMap of RELATION should be {}
  4. targetColumnMap is {"toto": "companyId"}

Is there a way to easily compute the right targetColumnMap from fieldMetadata. If it's too complex, maybe we should not invest too much here as we are going to deprecated targetColumnMap.
In this case, just fix default-value and we can merge. If you see an "easy" way of computing it and fixing it, let's go with that.

Also, fixing targetColumnMap might actually create more "MISSING_COLUMN" cases, as we don't migrate columns but I think it's fine, we can manually fix those, they should be pretty rare actually

@magrinj magrinj force-pushed the feat/workspace-health-target-colulmn-map-fix branch from 3749b95 to 0aeb022 Compare February 15, 2024 14:47
Copy link

TODOs/FIXMEs:

  • // TODO: run in a dedicated job + run queries in a transaction.: packages/twenty-server/src/workspace/workspace-sync-metadata/commands/sync-workspace-metadata.command.ts

Generated by 🚫 dangerJS against 0aeb022

Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

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

Tested, it works well!

@charlesBochet charlesBochet merged commit 990cb10 into main Feb 15, 2024
14 of 15 checks passed
@charlesBochet charlesBochet deleted the feat/workspace-health-target-colulmn-map-fix branch February 15, 2024 17:04
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.

feat: add ability to fix inconsistent targetColumnMap to workspace:health-check command
2 participants