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:
Tim Abbott 2018-12-18 13:04:34 -08:00
parent 8426785286
commit 3c70a61132
2 changed files with 1 additions and 2 deletions

View File

@ -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")

View File

@ -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")