Add featureFlag gateDecorator for sync-metadata #2956
Merged
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.
Context
Fixes #2924
We want to start to work on email integrations and add new models. However, those models should not impact all workspaces during our implementations (which will take a few sprints) so we should be able to edit or create a standard object and sync-metadata command should skip those modifications.
Realistically, the only way I see it for now is to add a parameter to ObjectMetadata / FieldMetadata decorators, if the sync-metadata service sees this, it should skip the field or the object entirely, meaning it will consider it does not exist OR does not exist anymore and will do the changes accordingly, except for workspaces with the flag. This brings some limitations but should be enough for this use case
Implementation
As explained above, this PR introduces a new GateDecorator that we can add on our standard Objects/Fields. For now you can provide a featureFlag parameter and we will make sure to match it with feature flags stored in the DB. If the flag is not present, we skip the object or field creation.
This has some limitations but should be enough for our needs for now.
Note: For relations, make sure you also gate both directions
&&