-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(model/featurestate): make environment not null (#2708)
- Loading branch information
1 parent
e71efbb
commit 55a9ef7
Showing
3 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
api/features/migrations/0060_set_featurestate_environment_not_null.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Generated by Django 3.2.20 on 2023-08-30 13:14 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
def delete_feature_states_without_environment(apps, schema_editor): | ||
FeatureState = apps.get_model("features", "FeatureState") | ||
FeatureState.objects.filter(environment__isnull=True).delete() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
atomic = False | ||
dependencies = [ | ||
( | ||
"environments", | ||
"0032_rename_use_mv_v2_evaluation_to_use_in_percentage_split_evaluation", | ||
), | ||
("features", "0059_fix_feature_type"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
delete_feature_states_without_environment, | ||
reverse_code=migrations.RunPython.noop, | ||
), | ||
migrations.AlterField( | ||
model_name="featurestate", | ||
name="environment", | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="feature_states", | ||
to="environments.environment", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55a9ef7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
flagsmith-frontend-staging – ./frontend
flagsmith-frontend-staging-git-main-flagsmith.vercel.app
flagsmith-frontend-staging-flagsmith.vercel.app
staging.flagsmith.com
flagsmith-staging-frontend.vercel.app
55a9ef7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
docs – ./docs
docs-flagsmith.vercel.app
docs-git-main-flagsmith.vercel.app
docs.flagsmith.com
docs.bullet-train.io
55a9ef7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
flagsmith-frontend-preview – ./frontend
flagsmith-frontend-production-native.vercel.app
flagsmith-frontend-preview-git-main-flagsmith.vercel.app
flagsmith-frontend-preview-flagsmith.vercel.app