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.

RemotePushDevice: Migrate token_kind from IntegerChoices to TextChoices.

Prakhar Pratyushe10d4134766d
diff --git a/zilencer/migrations/0066_alter_remotepushdevice_token_kind.py b/zilencer/migrations/0066_alter_remotepushdevice_token_kind.py
new file mode 100644
index 00000000000..7bbf73205d0
--- /dev/null
+++ b/zilencer/migrations/0066_alter_remotepushdevice_token_kind.py
@@ -0,0 +1,17 @@
+# Generated by Django 5.2.3 on 2025-07-09 13:11
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("zilencer", "0065_remotepushdevice"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="remotepushdevice",
+ name="token_kind",
+ field=models.CharField(choices=[("apns", "APNs"), ("fcm", "FCM")], max_length=4),
+ ),
+ ]
diff --git a/zilencer/models.py b/zilencer/models.py
index ac142dbb06d..5972ab6bb99 100644
--- a/zilencer/models.py
+++ b/zilencer/models.py
@@ -618,11 +618,11 @@ class RemotePushDevice(models.Model):
# that they're at most the maximum FCM / APNs payload size of 4096 bytes.
token = models.CharField(max_length=4096)
- class TokenKind(models.IntegerChoices):
- APNS = 1, "APNs"
- FCM = 2, "FCM"
+ class TokenKind(models.TextChoices):
+ APNS = "apns", "APNs"
+ FCM = "fcm", "FCM"
- token_kind = models.PositiveSmallIntegerField(choices=TokenKind.choices)
+ token_kind = models.CharField(max_length=4, choices=TokenKind.choices)
# 64-bit random integer ID generated by the client; will only be
# guaranteed to be unique within the client's own table of accounts.