Skip to content

Commit 331ce37

Browse files
committed
Remove unused uuid fields in flags and support
1 parent c25c3fd commit 331ce37

File tree

5 files changed

+49
-19
lines changed

5 files changed

+49
-19
lines changed

plain-flags/plain/flags/admin.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def get_text(self):
3131
class FlagAdmin(AdminViewset):
3232
class ListView(AdminModelListView):
3333
model = Flag
34-
fields = ["name", "enabled", "created_at__date", "used_at__date", "uuid"]
34+
fields = ["name", "enabled", "created_at__date", "used_at__date"]
3535
search_fields = ["name", "description"]
3636
cards = [UnusedFlagsCard]
3737
nav_section = "Feature flags"
@@ -58,7 +58,6 @@ class ListView(AdminModelListView):
5858
"value",
5959
"created_at__date",
6060
"updated_at__date",
61-
"uuid",
6261
]
6362
search_fields = ["flag__name", "key"]
6463
nav_section = "Feature flags"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Generated by Plain 0.68.1 on 2025-09-26 18:32
2+
3+
from plain.models import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
("plainflags", "0001_initial"),
9+
]
10+
11+
operations = [
12+
migrations.RemoveConstraint(
13+
model_name="flag",
14+
name="plainflags_flag_unique_uuid",
15+
),
16+
migrations.RemoveConstraint(
17+
model_name="flagresult",
18+
name="plainflags_flagresult_unique_uuid",
19+
),
20+
migrations.RemoveField(
21+
model_name="flag",
22+
name="uuid",
23+
),
24+
migrations.RemoveField(
25+
model_name="flagresult",
26+
name="uuid",
27+
),
28+
]

plain-flags/plain/flags/models.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import re
2-
import uuid
32

43
from plain import models
54
from plain.exceptions import ValidationError
@@ -18,7 +17,6 @@ def validate_flag_name(value):
1817

1918
@models.register_model
2019
class FlagResult(models.Model):
21-
uuid = models.UUIDField(default=uuid.uuid4)
2220
created_at = models.DateTimeField(auto_now_add=True)
2321
updated_at = models.DateTimeField(auto_now=True)
2422
flag = models.ForeignKey("Flag", on_delete=models.CASCADE)
@@ -30,9 +28,6 @@ class Meta:
3028
models.UniqueConstraint(
3129
fields=["flag", "key"], name="plainflags_flagresult_unique_key"
3230
),
33-
models.UniqueConstraint(
34-
fields=["uuid"], name="plainflags_flagresult_unique_uuid"
35-
),
3631
]
3732

3833
def __str__(self):
@@ -41,7 +36,6 @@ def __str__(self):
4136

4237
@models.register_model
4338
class Flag(models.Model):
44-
uuid = models.UUIDField(default=uuid.uuid4)
4539
created_at = models.DateTimeField(auto_now_add=True)
4640
updated_at = models.DateTimeField(auto_now=True)
4741
name = models.CharField(max_length=255, validators=[validate_flag_name])
@@ -61,9 +55,6 @@ class Meta:
6155
models.UniqueConstraint(
6256
fields=["name"], name="plainflags_flag_unique_name"
6357
),
64-
models.UniqueConstraint(
65-
fields=["uuid"], name="plainflags_flag_unique_uuid"
66-
),
6758
]
6859

6960
def __str__(self):
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Generated by Plain 0.68.1 on 2025-09-26 18:32
2+
3+
from plain.models import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
("plainsupport", "0001_initial"),
9+
]
10+
11+
operations = [
12+
migrations.RemoveConstraint(
13+
model_name="supportformentry",
14+
name="plainsupport_supportformentry_unique_uuid",
15+
),
16+
migrations.RemoveField(
17+
model_name="supportformentry",
18+
name="uuid",
19+
),
20+
]

plain-support/plain/support/models.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import uuid
2-
31
from plain import models
42
from plain.runtime import SettingsReference
53

64

75
@models.register_model
86
class SupportFormEntry(models.Model):
9-
uuid = models.UUIDField(default=uuid.uuid4)
107
user = models.ForeignKey(
118
SettingsReference("AUTH_USER_MODEL"),
129
on_delete=models.SET_NULL,
@@ -24,11 +21,6 @@ class SupportFormEntry(models.Model):
2421

2522
class Meta:
2623
ordering = ["-created_at"]
27-
constraints = [
28-
models.UniqueConstraint(
29-
fields=["uuid"], name="plainsupport_supportformentry_unique_uuid"
30-
),
31-
]
3224
indexes = [
3325
models.Index(fields=["created_at"]),
3426
]

0 commit comments

Comments
 (0)