-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13407 from saleor/13338-simplify-product-attribut…
…e-relation Simplify Product - Attribute relation
- Loading branch information
Showing
50 changed files
with
1,270 additions
and
856 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
saleor/attribute/migrations/0038_remove_assignedproductattribute.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Generated by Django 3.2.20 on 2023-07-11 16:10 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("attribute", "0037_remove_assignedpageattribute"), | ||
] | ||
|
||
state_operations = [ | ||
migrations.RemoveField( | ||
model_name="attributeproduct", | ||
name="assigned_products", | ||
), | ||
migrations.RemoveField( | ||
model_name="assignedproductattributevalue", | ||
name="assignment", | ||
), | ||
migrations.DeleteModel( | ||
name="AssignedProductAttribute", | ||
), | ||
migrations.AlterUniqueTogether( | ||
name="assignedproductattributevalue", | ||
unique_together={("value", "product")}, | ||
), | ||
migrations.AlterField( | ||
model_name="assignedproductattributevalue", | ||
name="product", | ||
field=models.ForeignKey( | ||
db_index=False, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="attributevalues", | ||
to="product.product", | ||
), | ||
), | ||
] | ||
|
||
operations = [ | ||
# Set FKs to allow null values before marking their models/fields deleted | ||
migrations.AlterField( | ||
model_name="assignedproductattributevalue", | ||
name="assignment", | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="productvalueassignment", | ||
to="attribute.AssignedProductAttribute", | ||
null=True, | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="assignedproductattribute", | ||
name="product", | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="attributes", | ||
to="product.Product", | ||
null=True, | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="assignedproductattribute", | ||
name="assignment", | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="productassignments", | ||
to="attribute.AttributeProduct", | ||
null=True, | ||
), | ||
), | ||
# Remove FK constraints so that the DB doesn't try to truncate the references | ||
migrations.RunSQL( | ||
""" | ||
ALTER TABLE attribute_assignedproductattribute | ||
DROP CONSTRAINT IF EXISTS | ||
attribute_assignedpr_assignment_id_f65ddd91_fk_attribute; | ||
ALTER TABLE attribute_assignedproductattribute | ||
DROP CONSTRAINT IF EXISTS | ||
attribute_assignedpr_product_id_c267932a_fk_product_p; | ||
ALTER TABLE attribute_assignedproductattributevalue | ||
DROP CONSTRAINT IF EXISTS | ||
attribute_assignedpa_assignment_id_6863be0a_fk_attribute; | ||
ALTER TABLE attribute_assignedproductattributevalue | ||
DROP CONSTRAINT IF EXISTS | ||
attribute_assignedproduc_value_id_assignment_id_ad6f5a87_uniq; | ||
""", | ||
reverse_sql=migrations.RunSQL.noop, | ||
), | ||
migrations.SeparateDatabaseAndState(state_operations=state_operations), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.