Skip to content

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

Revert "Prepare cart migration to new JSONField"

Krzysztof Wolski346b9078ce82
diff --git a/saleor/cart/migrations/0004_auto_20161209_0652.py b/saleor/cart/migrations/0004_auto_20161209_0652.py
deleted file mode 100644
index 2493a81b14..0000000000
--- a/saleor/cart/migrations/0004_auto_20161209_0652.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.10.3 on 2016-12-09 12:52
-from __future__ import unicode_literals
-
-import django.contrib.postgres.fields.jsonb
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('cart', 'fix_empty_data_in_lines'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='cart',
- name='checkout_data_postgres',
- field=django.contrib.postgres.fields.jsonb.JSONField(editable=False, null=True),
- ),
- migrations.AddField(
- model_name='cartline',
- name='data_postgres',
- field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, default={}),
- ),
- ]
diff --git a/saleor/cart/migrations/0005_migrate_json_data.py b/saleor/cart/migrations/0005_migrate_json_data.py
deleted file mode 100644
index a1ed9405d1..0000000000
--- a/saleor/cart/migrations/0005_migrate_json_data.py
+++ /dev/null
@@ -1,27 +0,0 @@
-from __future__ import unicode_literals
-
-import json
-from django.db import migrations
-
-
-def move_data(apps, schema_editor):
- CartLine = apps.get_model('cart', 'CartLine')
- for line in CartLine.objects.all():
- line.data_postgres = json.loads(line.data)
- line.save()
-
- Cart = apps.get_model('cart', 'Cart')
- for cart in Cart.objects.all():
- cart.checkout_data_postgres = json.loads(cart.checkout_data)
- cart.save()
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('cart', '0004_auto_20161209_0652'),
- ]
-
- operations = [
- migrations.RunPython(move_data)
- ]
diff --git a/saleor/cart/models.py b/saleor/cart/models.py
index 0dbdbab54b..fc55eedb23 100644
--- a/saleor/cart/models.py
+++ b/saleor/cart/models.py
@@ -12,7 +12,6 @@ from django.utils.encoding import python_2_unicode_compatible, smart_str
from django.utils.timezone import now
from django.utils.translation import pgettext_lazy
from django_prices.models import PriceField
-from django.contrib.postgres.fields import JSONField as postgres_JSONField
from jsonfield import JSONField
from satchless.item import ItemLine, ItemSet, ItemList, partition
@@ -102,7 +101,6 @@ class Cart(models.Model):
voucher = models.ForeignKey(
Voucher, null=True, related_name='+', on_delete=models.SET_NULL)
checkout_data = JSONField(null=True, editable=False)
- checkout_data_postgres = postgres_JSONField(null=True, editable=False)
total = PriceField(
currency=settings.DEFAULT_CURRENCY, max_digits=12, decimal_places=2,
@@ -231,7 +229,6 @@ class CartLine(models.Model, ItemLine):
pgettext_lazy('Cart line', 'quantity'),
validators=[MinValueValidator(0), MaxValueValidator(999)])
data = JSONField(blank=True, default={})
- data_postgres = postgres_JSONField(blank=True, default={})
class Meta:
unique_together = ('cart', 'variant', 'data')