Skip to content

Commit

Permalink
chore: use indexes instead of index_together in models
Browse files Browse the repository at this point in the history
index_together is deprecated and will be removed in django future
  • Loading branch information
hamadr committed Oct 17, 2023
1 parent 2eb70f7 commit 63a5f2c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dalec/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ class Meta:
ordering = ("-last_update_dt",)
get_latest_by = "last_update_dt"
abstract = True
index_together = (("app", "content_type", "channel", "channel_object"),)
indexes = [models.Index(fields=["app", "content_type", "channel", "channel_object"])]
23 changes: 23 additions & 0 deletions dalec_prime/migrations/0005_auto_20231017_1208.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.21 on 2023-10-17 10:08

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("dalec_prime", "0004_alter_content_id_alter_fetchhistory_id"),
]

operations = [
migrations.AlterIndexTogether(
name="content",
index_together=set(),
),
migrations.AddIndex(
model_name="content",
index=models.Index(
fields=["app", "content_type", "channel", "channel_object"],
name="dalec_prime_app_636e7d_idx",
),
),
]

0 comments on commit 63a5f2c

Please sign in to comment.