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.

2.5 KB
Raw Blame
# Generated by Django 5.2.11 on 2026-02-13 13:11

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):
    dependencies = [
        ("zerver", "0778_realm_rendered_description_version"),
    ]

    operations = [
        migrations.CreateModel(
            name="Device",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("push_key", models.BinaryField(null=True)),
                ("push_key_id", models.PositiveBigIntegerField(null=True)),
                ("push_token_id", models.BigIntegerField(null=True)),
                ("pending_push_token_id", models.BigIntegerField(null=True)),
                ("push_token_last_updated_timestamp", models.DateTimeField(null=True)),
                (
                    "push_token_kind",
                    models.CharField(
                        choices=[("apns", "APNs"), ("fcm", "FCM")], max_length=4, null=True
                    ),
                ),
                (
                    "push_registration_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={
                "indexes": [
                    models.Index(
                        condition=models.Q(("push_token_id__isnull", False)),
                        fields=["user", "push_token_id"],
                        name="zerver_device_user_push_token_id_idx",
                    )
                ],
                "constraints": [
                    models.CheckConstraint(
                        condition=models.Q(("push_key_id__lte", 4294967295)),
                        name="push_key_id_lte_max_push_key_id",
                    )
                ],
            },
        ),
    ]