models: Convert deprecated index_together option to indexes.

index_together is slated for removal in Django 5.1:
https://docs.djangoproject.com/en/4.2/internals/deprecation/#deprecation-removed-in-5-1

We set the optional index names to match the previously generated
index names to avoid adding new migrations.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2023-06-11 12:22:36 -07:00
committed by Tim Abbott
parent c238327899
commit 7e707270f0
9 changed files with 117 additions and 44 deletions

View File

@@ -115,8 +115,11 @@ class RemoteInstallationCount(BaseCount):
class Meta:
unique_together = ("server", "property", "subgroup", "end_time")
index_together = [
["server", "remote_id"],
indexes = [
models.Index(
fields=["server", "remote_id"],
name="zilencer_remoteinstallat_server_id_remote_id_f72e4c30_idx",
),
]
def __str__(self) -> str:
@@ -132,9 +135,15 @@ class RemoteRealmCount(BaseCount):
class Meta:
unique_together = ("server", "realm_id", "property", "subgroup", "end_time")
index_together = [
["property", "end_time"],
["server", "remote_id"],
indexes = [
models.Index(
fields=["property", "end_time"],
name="zilencer_remoterealmcount_property_end_time_506a0b38_idx",
),
models.Index(
fields=["server", "remote_id"],
name="zilencer_remoterealmcount_server_id_remote_id_de1573d8_idx",
),
]
def __str__(self) -> str: