Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

models: Make UserProfile.uuid not nullable.

Mateusz Manderac3209d379c74
diff --git a/zerver/migrations/0381_alter_userprofile_uuid.py b/zerver/migrations/0381_alter_userprofile_uuid.py
new file mode 100644
index 00000000000..92193b496a4
--- /dev/null
+++ b/zerver/migrations/0381_alter_userprofile_uuid.py
@@ -0,0 +1,20 @@
+# Generated by Django 3.2.12 on 2022-03-05 15:03
+
+import uuid
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("zerver", "0380_userprofile_uuid_backfill"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="userprofile",
+ name="uuid",
+ field=models.UUIDField(default=uuid.uuid4, unique=True),
+ ),
+ ]
diff --git a/zerver/models.py b/zerver/models.py
index 20c50199100..d816a7477ad 100644
--- a/zerver/models.py
+++ b/zerver/models.py
@@ -1693,7 +1693,7 @@ class UserProfile(AbstractBaseUser, PermissionsMixin, UserBaseSettings):
# provide a unique key for a user for the mobile push
# notifications bouncer that will not have collisions after doing
# a data export and then import.
- uuid: Optional[UUID] = models.UUIDField(null=True, default=uuid4, unique=True)
+ uuid: UUID = models.UUIDField(default=uuid4, unique=True)
# Whether the user has access to server-level administrator pages, like /activity
is_staff: bool = models.BooleanField(default=False)