From 91a057873d2f8f51ab939fc0d63ee94b45890de9 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Sat, 1 Apr 2017 18:10:51 -0300 Subject: [PATCH] Merge migrations --- kfet/migrations/0049_remove_checkout.py | 38 ------------------------- kfet/migrations/0050_remove_checkout.py | 23 +++++++++++++++ 2 files changed, 23 insertions(+), 38 deletions(-) delete mode 100644 kfet/migrations/0049_remove_checkout.py create mode 100644 kfet/migrations/0050_remove_checkout.py diff --git a/kfet/migrations/0049_remove_checkout.py b/kfet/migrations/0049_remove_checkout.py deleted file mode 100644 index d2eae10c..00000000 --- a/kfet/migrations/0049_remove_checkout.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -def adapt_operation_types(apps, schema_editor): - Operation = apps.get_model("kfet", "Operation") - Operation.objects.filter( - is_checkout=False, - type__in=['withdraw', 'deposit']).update(type='edit') - - -def revert_operation_types(apps, schema_editor): - Operation = apps.get_model("kfet", "Operation") - edits = Operation.objects.filter(type='edit') - edits.filter(amount__gt=0).update(type='deposit') - edits.filter(amount__lte=0).update(type='withdraw') - - -class Migration(migrations.Migration): - - dependencies = [ - ('kfet', '0048_article_hidden'), - ] - - operations = [ - migrations.AlterField( - model_name='operation', - name='type', - field=models.CharField(choices=[('purchase', 'Achat'), ('deposit', 'Charge'), ('withdraw', 'Retrait'), ('initial', 'Initial'), ('edit', 'Édition')], max_length=8), - ), - migrations.RunPython(adapt_operation_types, revert_operation_types), - migrations.RemoveField( - model_name='operation', - name='is_checkout', - ), - ] diff --git a/kfet/migrations/0050_remove_checkout.py b/kfet/migrations/0050_remove_checkout.py new file mode 100644 index 00000000..f9c374ca --- /dev/null +++ b/kfet/migrations/0050_remove_checkout.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('kfet', '0049_merge'), + ] + + operations = [ + migrations.RemoveField( + model_name='operation', + name='is_checkout', + ), + migrations.AlterField( + model_name='operation', + name='type', + field=models.CharField(choices=[('purchase', 'Achat'), ('deposit', 'Charge'), ('withdraw', 'Retrait'), ('initial', 'Initial'), ('edit', 'Édition')], max_length=8), + ), + ]