mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
models: Deduplicate definitions of push tokens.
Since c57c4cf703, these are no longer
different implementations, so we can deduplicate them. Because Django
is smart, no migration is required.
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user