Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add index by (category_id, slug) to product_product table (#16194)
Marcin Gębalad43a4b870fa6
diff --git a/saleor/product/migrations/0194_auto_20240620_1404.py b/saleor/product/migrations/0194_auto_20240620_1404.pynew file mode 100644index 0000000000..624d1aab06--- /dev/null+++ b/saleor/product/migrations/0194_auto_20240620_1404.py@@ -0,0 +1,21 @@+# Generated by Django 3.2.23 on 2024-06-20 14:04++from django.contrib.postgres.operations import AddIndexConcurrently+from django.db import migrations, models+++class Migration(migrations.Migration):+ atomic = False++ dependencies = [+ ("product", "0193_merge_20240513_1105"),+ ]++ operations = [+ AddIndexConcurrently(+ model_name="product",+ index=models.Index(+ fields=["category_id", "slug"], name="product_pro_categor_8de99d_idx"+ ),+ ),+ ]diff --git a/saleor/product/models.py b/saleor/product/models.pyindex b6a9ac2803..1885558044 100644--- a/saleor/product/models.py+++ b/saleor/product/models.py@@ -231,6 +231,9 @@ class Product(SeoModel, ModelWithMetadata, ModelWithExternalReference):fields=["name", "slug"],opclasses=["gin_trgm_ops"] * 2,),+ models.Index(+ fields=["category_id", "slug"],+ ),]indexes.extend(ModelWithMetadata.Meta.indexes)