Skip to content

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

Add migration to fix variant's attributes' default value

Marcin Gębala83c7b6639f53
diff --git a/saleor/product/migrations/0027_auto_20150625_0319.py b/saleor/product/migrations/0027_auto_20150625_0319.py
new file mode 100644
index 0000000000..291e5e1201
--- /dev/null
+++ b/saleor/product/migrations/0027_auto_20150625_0319.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+def clear_attributes(apps, schema_editor):
+ Variant = apps.get_model("product", "ProductVariant")
+ for variant in Variant.objects.all():
+ variant.attributes = {}
+ variant.save()
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('product', '0026_auto_20150624_0921'),
+ ]
+
+ operations = [
+ migrations.RunPython(clear_attributes),
+ ]