File tree Expand file tree Collapse file tree
back/back/apps/people/migrations Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44from django .db import migrations , models
55
66
7+ def create_uuid (apps , schema_editor ):
8+ User = apps .get_model ("people" , "User" )
9+ for user in User .objects .all ():
10+ user .sender_uuid = uuid .uuid4 ()
11+ user .save (update_fields = ["sender_uuid" ])
12+
713class Migration (migrations .Migration ):
814
915 dependencies = [
@@ -19,7 +25,19 @@ class Migration(migrations.Migration):
1925 default = uuid .uuid4 ,
2026 editable = False ,
2127 help_text = "Universal sender identifier for lefebvre-chatfaq integration" ,
22- unique = True ,
28+ null = True , # Change unique=True to null=True here
29+ ),
30+ ),
31+ migrations .RunPython (create_uuid , reverse_code = migrations .RunPython .noop ),
32+ migrations .AlterField (
33+ model_name = "user" ,
34+ name = "sender_uuid" ,
35+ field = models .UUIDField (
36+ db_index = True ,
37+ default = uuid .uuid4 ,
38+ editable = False ,
39+ help_text = "Universal sender identifier for lefebvre-chatfaq integration" ,
40+ unique = True , # This one remains unique=True
2341 ),
2442 ),
2543 ]
You can’t perform that action at this time.
0 commit comments