From 3c70a61132960a997be687335b984296732d7459 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 18 Dec 2018 13:04:34 -0800 Subject: [PATCH] models: Deduplicate definitions of push tokens. Since c57c4cf7039331a2ebed4b6c284517929993b898, these are no longer different implementations, so we can deduplicate them. Because Django is smart, no migration is required. --- zerver/models.py | 2 +- zilencer/models.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/zerver/models.py b/zerver/models.py index 0273945025..d68dce93a9 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -1080,6 +1080,7 @@ class AbstractPushDeviceToken(models.Model): # sent to us from each device: # - APNS token if kind == APNS # - GCM registration id if kind == GCM + token = models.CharField(max_length=4096, db_index=True) # type: bytes # TODO: last_updated should be renamed date_created, since it is # no longer maintained as a last_updated value. @@ -1094,7 +1095,6 @@ class AbstractPushDeviceToken(models.Model): class PushDeviceToken(AbstractPushDeviceToken): # The user who's device this is user = models.ForeignKey(UserProfile, db_index=True, on_delete=CASCADE) # type: UserProfile - token = models.CharField(max_length=4096, db_index=True) # type: bytes class Meta: unique_together = ("user", "kind", "token") diff --git a/zilencer/models.py b/zilencer/models.py index 884ca4d974..8bee60ce16 100644 --- a/zilencer/models.py +++ b/zilencer/models.py @@ -27,7 +27,6 @@ class RemotePushDeviceToken(AbstractPushDeviceToken): server = models.ForeignKey(RemoteZulipServer, on_delete=models.CASCADE) # type: RemoteZulipServer # The user id on the remote server for this device device this is user_id = models.BigIntegerField(db_index=True) # type: int - token = models.CharField(max_length=4096, db_index=True) # type: bytes class Meta: unique_together = ("server", "user_id", "kind", "token")