Skip to content

Commit c6ea80f

Browse files
committed
revert: #4817
1 parent a33633f commit c6ea80f

File tree

4 files changed

+4
-150
lines changed

4 files changed

+4
-150
lines changed

api/tests/unit/users/test_unit_users_migrations.py

-53
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
# Generated by Django 4.2.16 on 2024-11-04 17:09
2-
from django.apps.registry import Apps
32
from django.db import migrations, models
4-
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
5-
from django.db.models import F
6-
from django.db.models.functions import Left
7-
8-
9-
def populate_new_first_name_field(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None:
10-
FFAdminUser = apps.get_model("users", "FFAdminUser")
11-
12-
FFAdminUser.objects.update(first_name_v2=F("first_name"))
13-
14-
15-
def populate_old_first_name_field(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None:
16-
FFAdminUser = apps.get_model("users", "FFAdminUser")
17-
18-
FFAdminUser.objects.update(first_name=Left("first_name_v2", 30))
193

204

215
class Migration(migrations.Migration):
@@ -25,38 +9,9 @@ class Migration(migrations.Migration):
259
]
2610

2711
operations = [
28-
migrations.AddField(
12+
migrations.AlterField(
2913
model_name="ffadminuser",
30-
name="first_name_v2",
31-
field=models.CharField(max_length=150, default=""),
14+
name="first_name",
15+
field=models.CharField(max_length=150, verbose_name="first name"),
3216
),
33-
migrations.RunPython(populate_new_first_name_field, reverse_code=populate_old_first_name_field),
34-
migrations.SeparateDatabaseAndState(
35-
state_operations=[
36-
migrations.RenameField(
37-
model_name="ffadminuser",
38-
old_name="first_name",
39-
new_name="_first_name_old",
40-
),
41-
migrations.RenameField(
42-
model_name="ffadminuser",
43-
old_name="first_name_v2",
44-
new_name="first_name",
45-
),
46-
migrations.AlterField(
47-
model_name="ffadminuser",
48-
name="_first_name_old",
49-
field=models.CharField(
50-
db_column="first_name", max_length=30, verbose_name="first name"
51-
),
52-
),
53-
migrations.AlterField(
54-
model_name="ffadminuser",
55-
name="first_name",
56-
field=models.CharField(
57-
db_column="first_name_v2", max_length=150, verbose_name="first name"
58-
),
59-
),
60-
]
61-
)
6217
]

api/users/migrations/0040_alter_ffadminuser_first_name_fix.py

-42
This file was deleted.

api/users/models.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ class FFAdminUser(LifecycleModel, AbstractUser):
9999
email = models.EmailField(unique=True, null=False)
100100
objects = UserManager()
101101
username = models.CharField(unique=True, max_length=150, null=True, blank=True)
102-
first_name = models.CharField(
103-
"first name", max_length=150, db_column="first_name_v2"
104-
)
102+
first_name = models.CharField("first name", max_length=150)
105103
last_name = models.CharField("last name", max_length=150)
106104
google_user_id = models.CharField(max_length=50, null=True, blank=True)
107105
github_user_id = models.CharField(max_length=50, null=True, blank=True)
@@ -113,10 +111,6 @@ class FFAdminUser(LifecycleModel, AbstractUser):
113111
choices=SignUpType.choices, max_length=100, blank=True, null=True
114112
)
115113

116-
_first_name_old = models.CharField(
117-
"first name", max_length=30, db_column="first_name"
118-
)
119-
120114
uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
121115

122116
USERNAME_FIELD = "email"

0 commit comments

Comments
 (0)