Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add concurrently for new release (#13707)

Krzysztof Waliczek5437ec5dd0db
diff --git a/saleor/channel/migrations/0013_auto_20230630_1039.py b/saleor/channel/migrations/0013_auto_20230630_1039.py
index ef1271af4a..fddf84ddcc 100644
--- a/saleor/channel/migrations/0013_auto_20230630_1039.py
+++ b/saleor/channel/migrations/0013_auto_20230630_1039.py
@@ -1,6 +1,5 @@
# Generated by Django 3.2.19 on 2023-06-30 10:39
-import django.contrib.postgres.indexes
from django.db import migrations, models
import saleor.core.utils.json_serializer
@@ -31,16 +30,4 @@ class Migration(migrations.Migration):
null=True,
),
),
- migrations.AddIndex(
- model_name="channel",
- index=django.contrib.postgres.indexes.GinIndex(
- fields=["private_metadata"], name="channel_p_meta_idx"
- ),
- ),
- migrations.AddIndex(
- model_name="channel",
- index=django.contrib.postgres.indexes.GinIndex(
- fields=["metadata"], name="channel_meta_idx"
- ),
- ),
]
diff --git a/saleor/channel/migrations/0016_auto_20230816_1209.py b/saleor/channel/migrations/0016_auto_20230816_1209.py
new file mode 100644
index 0000000000..1fbf7882ff
--- /dev/null
+++ b/saleor/channel/migrations/0016_auto_20230816_1209.py
@@ -0,0 +1,28 @@
+# Generated by Django 3.2.20 on 2023-08-16 12:09
+
+from django.contrib.postgres.operations import AddIndexConcurrently
+import django.contrib.postgres.indexes
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ atomic = False
+
+ dependencies = [
+ ("channel", "0015_channel_use_legacy_error_flow_for_checkout"),
+ ]
+
+ operations = [
+ AddIndexConcurrently(
+ model_name="channel",
+ index=django.contrib.postgres.indexes.GinIndex(
+ fields=["private_metadata"], name="channel_p_meta_idx"
+ ),
+ ),
+ AddIndexConcurrently(
+ model_name="channel",
+ index=django.contrib.postgres.indexes.GinIndex(
+ fields=["metadata"], name="channel_meta_idx"
+ ),
+ ),
+ ]
diff --git a/saleor/order/migrations/0170_auto_20230529_1314.py b/saleor/order/migrations/0170_auto_20230529_1314.py
index 063d02461d..821db2e43a 100644
--- a/saleor/order/migrations/0170_auto_20230529_1314.py
+++ b/saleor/order/migrations/0170_auto_20230529_1314.py
@@ -19,6 +19,7 @@ class Migration(migrations.Migration):
on_delete=django.db.models.deletion.SET_NULL,
related_name="related_events",
to="order.orderevent",
+ db_index=False,
),
),
migrations.AlterField(
diff --git a/saleor/order/migrations/0173_auto_20230816_1245.py b/saleor/order/migrations/0173_auto_20230816_1245.py
new file mode 100644
index 0000000000..fc6a318c50
--- /dev/null
+++ b/saleor/order/migrations/0173_auto_20230816_1245.py
@@ -0,0 +1,22 @@
+# Generated by Django 3.2.20 on 2023-08-16 12:45
+
+from django.contrib.postgres.operations import AddIndexConcurrently
+from django.contrib.postgres.indexes import BTreeIndex
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ atomic = False
+
+ dependencies = [
+ ("order", "0172_auto_20230627_0816"),
+ ]
+
+ operations = [
+ AddIndexConcurrently(
+ model_name="orderevent",
+ index=BTreeIndex(
+ fields=["related"], name="order_orderevent_related_id_idx"
+ ),
+ )
+ ]
diff --git a/saleor/order/models.py b/saleor/order/models.py
index 7ce8f130c3..ee596af066 100644
--- a/saleor/order/models.py
+++ b/saleor/order/models.py
@@ -5,7 +5,7 @@ from typing import TYPE_CHECKING, List, Optional, cast
from uuid import uuid4
from django.conf import settings
-from django.contrib.postgres.indexes import GinIndex
+from django.contrib.postgres.indexes import BTreeIndex, GinIndex
from django.contrib.postgres.search import SearchVectorField
from django.core.validators import MinValueValidator
from django.db import connection, models
@@ -809,10 +809,14 @@ class OrderEvent(models.Model):
null=True,
on_delete=models.SET_NULL,
related_name="related_events",
+ db_index=False,
)
class Meta:
ordering = ("date",)
+ indexes = [
+ BTreeIndex(fields=["related"], name="order_orderevent_related_id_idx")
+ ]
def __repr__(self):
return f"{self.__class__.__name__}(type={self.type!r}, user={self.user!r})"
diff --git a/saleor/payment/migrations/0052_auto_20230816_1214.py b/saleor/payment/migrations/0052_auto_20230816_1214.py
new file mode 100644
index 0000000000..7055852fbd
--- /dev/null
+++ b/saleor/payment/migrations/0052_auto_20230816_1214.py
@@ -0,0 +1,19 @@
+# Generated by Django 3.2.20 on 2023-08-16 12:14
+
+from django.contrib.postgres.operations import RemoveIndexConcurrently
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ atomic = False
+
+ dependencies = [
+ ("payment", "0051_alter_transactionitem_available_actions"),
+ ]
+
+ operations = [
+ RemoveIndexConcurrently(
+ model_name="transactionitem",
+ name="payment_tra_order_i_e783c4_gin",
+ )
+ ]
diff --git a/saleor/payment/migrations/0052_auto_20230601_0818.py b/saleor/payment/migrations/0053_auto_20230601_0818.py
similarity index 73%
rename from saleor/payment/migrations/0052_auto_20230601_0818.py
rename to saleor/payment/migrations/0053_auto_20230601_0818.py
index 147be61857..d565c82f4f 100644
--- a/saleor/payment/migrations/0052_auto_20230601_0818.py
+++ b/saleor/payment/migrations/0053_auto_20230601_0818.py
@@ -5,14 +5,10 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
- ("payment", "0051_alter_transactionitem_available_actions"),
+ ("payment", "0052_auto_20230816_1214"),
]
operations = [
- migrations.RemoveIndex(
- model_name="transactionitem",
- name="payment_tra_order_i_e783c4_gin",
- ),
migrations.SeparateDatabaseAndState(
state_operations=[
migrations.RemoveField(