Flagsmith / Flagsmith/flagsmith

FeatureSegment improvements

Open
#2,654 0 comments 0 reactions 0 assignees View on GitHub
api improvement
Dominant language
Python
Stars
6.6k
Forks
567
Avg merge
1d 13h
Merged PRs (30d)
121

Description

At the moment the relationship from FeatureState to FeatureSegment is a ForeignKey, this _technically_ allows a feature segment to have multiple feature states which should not be the case. I have looked into resolving this and determined the following things that we should look to improve:

1. FeatureSegments are not soft deleted. This looks to be because of the clash between the OrderedModelManager and the SoftDeleteManager.
2. There are a number of FeatureSegments in the database that currently have more than one FeatureState. I am not sure on how this has happened as it should fail the uniqueness check done when creating the FeatureState. This should be investigated and prevented, however, enforcing the uniqueness in another location might help us identify how / why this is happening.

As a longer term goal, we should remove the FeatureSegment model entirely. It is simply duplicating data from the FeatureState now.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.