Skip to content

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

Add missing DB index for account private metadata (#11584)

Tomasz Szymański2e725e0dd63f
diff --git a/saleor/account/migrations/0063_user_user_p_meta_jsonb_path_idx.py b/saleor/account/migrations/0063_user_user_p_meta_jsonb_path_idx.py
new file mode 100644
index 0000000000..eb669c1106
--- /dev/null
+++ b/saleor/account/migrations/0063_user_user_p_meta_jsonb_path_idx.py
@@ -0,0 +1,22 @@
+# Generated by Django 3.2.16 on 2022-12-27 10:22
+
+import django.contrib.postgres.indexes
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("account", "0062_alter_user_updated_at"),
+ ]
+
+ operations = [
+ migrations.AddIndex(
+ model_name="user",
+ index=django.contrib.postgres.indexes.GinIndex(
+ fields=["private_metadata"],
+ name="user_p_meta_jsonb_path_idx",
+ opclasses=["jsonb_path_ops"],
+ ),
+ ),
+ ]
diff --git a/saleor/account/migrations/0065_merge_20221227_1254.py b/saleor/account/migrations/0065_merge_20221227_1254.py
new file mode 100644
index 0000000000..351553301e
--- /dev/null
+++ b/saleor/account/migrations/0065_merge_20221227_1254.py
@@ -0,0 +1,13 @@
+# Generated by Django 3.2.16 on 2022-12-27 12:54
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("account", "0063_user_user_p_meta_jsonb_path_idx"),
+ ("account", "0064_rewrite_customerevent_order_relation"),
+ ]
+
+ operations = []
diff --git a/saleor/account/migrations/0066_merge_20221227_1315.py b/saleor/account/migrations/0066_merge_20221227_1315.py
new file mode 100644
index 0000000000..4196c8b68b
--- /dev/null
+++ b/saleor/account/migrations/0066_merge_20221227_1315.py
@@ -0,0 +1,13 @@
+# Generated by Django 3.2.16 on 2022-12-27 13:15
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("account", "0065_address_warehouse_address_search_gin"),
+ ("account", "0065_merge_20221227_1254"),
+ ]
+
+ operations = []
diff --git a/saleor/account/migrations/0071_merge_0066_merge_20221227_1315_0070_alter_user_uuid.py b/saleor/account/migrations/0071_merge_0066_merge_20221227_1315_0070_alter_user_uuid.py
new file mode 100644
index 0000000000..ac5e44ba12
--- /dev/null
+++ b/saleor/account/migrations/0071_merge_0066_merge_20221227_1315_0070_alter_user_uuid.py
@@ -0,0 +1,13 @@
+# Generated by Django 3.2.16 on 2022-12-27 13:45
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("account", "0066_merge_20221227_1315"),
+ ("account", "0070_alter_user_uuid"),
+ ]
+
+ operations = []
diff --git a/saleor/account/migrations/0072_merge_20221227_1353.py b/saleor/account/migrations/0072_merge_20221227_1353.py
new file mode 100644
index 0000000000..0174867ade
--- /dev/null
+++ b/saleor/account/migrations/0072_merge_20221227_1353.py
@@ -0,0 +1,13 @@
+# Generated by Django 3.2.16 on 2022-12-27 13:53
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("account", "0071_merge_0066_merge_20221227_1315_0070_alter_user_uuid"),
+ ("account", "0071_user_external_reference"),
+ ]
+
+ operations = []
diff --git a/saleor/account/models.py b/saleor/account/models.py
index 5166bc4ef2..78cf2930ef 100644
--- a/saleor/account/models.py
+++ b/saleor/account/models.py
@@ -213,6 +213,11 @@ class User(
fields=["search_document"],
opclasses=["gin_trgm_ops"],
),
+ GinIndex(
+ name="user_p_meta_jsonb_path_idx",
+ fields=["private_metadata"],
+ opclasses=["jsonb_path_ops"],
+ ),
]
def __init__(self, *args, **kwargs):