Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add index to meta fields on GiftCard model. (#11895)
Piotr Zabieglikc8a9f86f47e1
diff --git a/saleor/giftcard/migrations/0018_metadata_index.py b/saleor/giftcard/migrations/0018_metadata_index.pynew file mode 100644index 0000000000..a59d69804a--- /dev/null+++ b/saleor/giftcard/migrations/0018_metadata_index.py@@ -0,0 +1,26 @@+# Generated by Django 3.2.16 on 2023-02-01 12:42++import django.contrib.postgres.indexes+from django.db import migrations+++class Migration(migrations.Migration):++ dependencies = [+ ("giftcard", "0017_alter_giftcard_code"),+ ]++ operations = [+ migrations.AddIndex(+ model_name="giftcard",+ index=django.contrib.postgres.indexes.GinIndex(+ fields=["private_metadata"], name="giftcard_p_meta_idx"+ ),+ ),+ migrations.AddIndex(+ model_name="giftcard",+ index=django.contrib.postgres.indexes.GinIndex(+ fields=["metadata"], name="giftcard_meta_idx"+ ),+ ),+ ]diff --git a/saleor/giftcard/models.py b/saleor/giftcard/models.pyindex 91992e5315..e55770f499 100644--- a/saleor/giftcard/models.py+++ b/saleor/giftcard/models.py@@ -113,7 +113,7 @@ class GiftCard(ModelWithMetadata):objects = GiftCardManager()- class Meta:+ class Meta(ModelWithMetadata.Meta):ordering = ("code",)permissions = ((GiftcardPermissions.MANAGE_GIFT_CARD.codename, "Manage gift cards."),