Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewelwell committed May 9, 2024
1 parent 53d35d0 commit 5b830e8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions api/features/versioning/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def enable_v2_versioning(environment_id: int) -> None:
@register_task_handler()
def disable_v2_versioning(environment_id: int) -> None:
from environments.models import Environment
from features.models import FeatureState
from features.models import FeatureSegment, FeatureState
from features.versioning.models import EnvironmentFeatureVersion

environment = Environment.objects.get(id=environment_id)
Expand All @@ -50,11 +50,14 @@ def disable_v2_versioning(environment_id: int) -> None:
id__in=[fs.id for fs in latest_feature_states]
).delete()

# update the latest feature states to be the latest version according
# to the old versioning system
# update the latest feature states (and respective feature segments) to be the
# latest version according to the old versioning system
latest_feature_states.update(
version=1, live_from=timezone.now(), environment_feature_version=None
)
FeatureSegment.objects.filter(environment=environment).update(
environment_feature_version=None
)

EnvironmentFeatureVersion.objects.filter(environment=environment).delete()

Expand Down

0 comments on commit 5b830e8

Please sign in to comment.