Files
zulip/zerver/migrations/0730_pushdevice.py
Prakhar Pratyush 6a4b06b6f4 zerver: Add PushDevice model.
This commit adds a `PushDevice` model where each row
corresponds to an account on an install of the app
that has attempted to register with the bouncer to
receive mobile push notifications.

This is the core server table storing registrations
that are potentially registered with the mobile push
notifications bouncer service.
2025-07-14 14:52:38 -07:00

59 lines
2.0 KiB
Python

# Generated by Django 5.2.3 on 2025-07-13 03:14
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zerver", "0729_externalauthid"),
]
operations = [
migrations.CreateModel(
name="PushDevice",
fields=[
(
"id",
models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
(
"token_kind",
models.CharField(choices=[("apns", "APNs"), ("fcm", "FCM")], max_length=4),
),
("push_account_id", models.BigIntegerField()),
("push_public_key", models.TextField()),
("bouncer_device_id", models.BigIntegerField(null=True)),
(
"error_code",
models.CharField(
choices=[
("INVALID_BOUNCER_PUBLIC_KEY", "Invalid Bouncer Public Key"),
("BAD_REQUEST", "Invalid Encrypted Push Registration"),
("REQUEST_EXPIRED", "Request Expired"),
],
max_length=100,
null=True,
),
),
(
"user",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
),
),
],
options={
"constraints": [
models.UniqueConstraint(
fields=("user", "push_account_id"),
name="unique_push_device_user_push_account_id",
)
],
},
),
]