Skip to content

Commit

Permalink
Replace use of index_together
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed Aug 21, 2024
1 parent 8ed9f98 commit 535c62b
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 5.1 on 2024-08-21 12:22

from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("categories", "0010_alter_category_created_by_alter_category_modified_by_and_more"),
("orgs", "0033_alter_orgbackend_unique_together_and_more"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.AlterUniqueTogether(
name="category",
unique_together=set(),
),
migrations.AddConstraint(
model_name="category",
constraint=models.UniqueConstraint(
fields=("name", "org"), name="categories_category_name_318a92307e6f39fb_uniq"
),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ class Migration(migrations.Migration):
]

operations = [
migrations.AlterIndexTogether(
name="dashblock",
index_together={("org", "is_active", "dashblock_type", "priority")},
migrations.AddIndex(
model_name="dashblock",
index=models.Index(
fields=["org", "is_active", "dashblock_type", "priority"], name="dashblocks__org_id_024805_idx"
),
),
migrations.AlterIndexTogether(
name="dashblocktype",
index_together={("slug", "name")},
migrations.AddIndex(
model_name="dashblocktype", index=models.Index(fields=["slug", "name"], name="dashblocks__slug_c0c6c6_idx")
),
]
4 changes: 2 additions & 2 deletions dash/dashblocks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __str__(self):

class Meta:
ordering = ["name"]
indexes = [models.Index(fields=["slug", "name"])]
indexes = [models.Index(fields=["slug", "name"], name=None)]


class DashBlock(SmartModel):
Expand Down Expand Up @@ -149,7 +149,7 @@ def __str__(self):

class Meta:
ordering = ["dashblock_type", "title"]
indexes = [models.Index(fields=["org", "is_active", "dashblock_type", "priority"])]
indexes = [models.Index(fields=["org", "is_active", "dashblock_type", "priority"], name=None)]


class DashBlockImage(SmartModel):
Expand Down
8 changes: 4 additions & 4 deletions dash/orgs/migrations/0031_alter_orgbackend_index_together.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class Migration(migrations.Migration):
]

operations = [
migrations.AlterIndexTogether(
name="orgbackend",
index_together={("org", "is_active", "slug")},
),
migrations.AddIndex(
model_name="orgbackend",
index=models.Index(fields=["org", "is_active", "slug"], name="orgs_orgbac_org_id_607508_idx"),
)
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generated by Django 5.1 on 2024-08-21 12:22

from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("orgs", "0032_rename_orgbackend_org_is_active_slug_orgs_orgbac_org_id_607508_idx"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.AlterUniqueTogether(
name="orgbackend",
unique_together=set(),
),
migrations.AlterUniqueTogether(
name="taskstate",
unique_together=set(),
),
migrations.AddConstraint(
model_name="orgbackend",
constraint=models.UniqueConstraint(
fields=("org", "slug"), name="orgs_orgbackend_org_id_slug_03bef4c1_uniq"
),
),
migrations.AddConstraint(
model_name="taskstate",
constraint=models.UniqueConstraint(
fields=("org", "task_key"), name="orgs_taskstate_org_id_70fc0194720c6cf5_uniq"
),
),
]
24 changes: 24 additions & 0 deletions dash/tags/migrations/0003_alter_tag_unique_together_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 5.1 on 2024-08-21 12:22

from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("orgs", "0033_alter_orgbackend_unique_together_and_more"),
("tags", "0002_alter_tag_created_by_alter_tag_modified_by"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.AlterUniqueTogether(
name="tag",
unique_together=set(),
),
migrations.AddConstraint(
model_name="tag",
constraint=models.UniqueConstraint(fields=("name", "org"), name="tags_tag_name_org_id_e64e146b_uniq"),
),
]

0 comments on commit 535c62b

Please sign in to comment.