Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Clear db leftovers after attribute refactor (#15372)
Iga Karbowiakaeb8068409e1
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ac25902ca2..6e91b27559 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -30,6 +30,7 @@ All notable, unreleased changes to this project will be documented in this file.- Added caching of GraphQL documents for common queries to improve performance - #14843 by @patrys- Added `VOUCHER_CODES_CREATED` and `VOUCHER_CODES_DELETED` webhooks events. - #14652 by @SzymJ- Fixed validation for streetAddress1 or streetAddress2 are too long - #13973 by sonbui00+- Clear db leftovers after attribute refactor - #15372 by @IKarbowiak# 3.18.0diff --git a/saleor/attribute/migrations/0040_clear_assignedattributes.py b/saleor/attribute/migrations/0040_clear_assignedattributes.pynew file mode 100644index 0000000000..5684e04fd1--- /dev/null+++ b/saleor/attribute/migrations/0040_clear_assignedattributes.py@@ -0,0 +1,78 @@+# Generated by Django 3.2.23 on 2024-02-09 08:13++from django.db import migrations+++class Migration(migrations.Migration):+ dependencies = [+ ("attribute", "0039_merge_20231113_1132"),+ ]++ operations = [+ migrations.SeparateDatabaseAndState(+ database_operations=[+ migrations.RunSQL(+ """+ ALTER TABLE attribute_assignedproductattributevalue+ DROP COLUMN assignment_id;++ ALTER TABLE attribute_assignedproductattributevalue+ ALTER COLUMN product_id SET NOT NULL;++ ALTER TABLE attribute_assignedproductattributevalue+ ADD CONSTRAINT attribute_assignedproduc_value_id_product_id_6f6deb31_uniq+ UNIQUE (value_id, product_id);++ DROP TABLE attribute_assignedproductattribute;+ """,+ reverse_sql="""+ ALTER TABLE attribute_assignedproductattributevalue+ ADD COLUMN assignment_id int;++ ALTER TABLE attribute_assignedproductattributevalue+ ALTER COLUMN product_id DROP NOT NULL;++ ALTER TABLE attribute_assignedproductattributevalue+ DROP CONSTRAINT IF EXISTS attribute_assignedproduc_value_id_product_id_6f6deb31_uniq;++ CREATE TABLE attribute_assignedproductattribute (+ id serial NOT NULL PRIMARY KEY,+ assignment_id integer,+ product_id integer+ );+ """,+ ),+ migrations.RunSQL(+ """+ ALTER TABLE attribute_assignedpageattributevalue+ DROP COLUMN assignment_id;++ ALTER TABLE attribute_assignedpageattributevalue+ ALTER COLUMN page_id SET NOT NULL;++ ALTER TABLE attribute_assignedpageattributevalue+ ADD CONSTRAINT attribute_assignedpageat_value_id_page_id_851cd501_uniq+ UNIQUE (value_id, page_id);++ DROP TABLE attribute_assignedpageattribute;+ """,+ reverse_sql="""+ ALTER TABLE attribute_assignedpageattributevalue+ ADD COLUMN assignment_id int;++ ALTER TABLE attribute_assignedpageattributevalue+ ALTER COLUMN page_id DROP NOT NULL;++ ALTER TABLE attribute_assignedpageattributevalue+ DROP CONSTRAINT IF EXISTS attribute_assignedpageat_value_id_page_id_851cd501_uniq;++ CREATE TABLE attribute_assignedpageattribute (+ id serial NOT NULL PRIMARY KEY,+ assignment_id integer,+ page_id integer+ );+ """,+ ),+ ],+ ),+ ]