From 588f513f2a1330a30829d3cb9f575f1acd814a39 Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 12 Apr 2018 07:59:04 +0200 Subject: [PATCH] Remove initial VMPricing code from migration --- ...409_1923.py => 0019_auto_20180410_1948.py} | 2 +- .../migrations/0020_auto_20180409_1928.py | 48 ------------------- 2 files changed, 1 insertion(+), 49 deletions(-) rename datacenterlight/migrations/{0019_auto_20180409_1923.py => 0019_auto_20180410_1948.py} (97%) delete mode 100644 datacenterlight/migrations/0020_auto_20180409_1928.py diff --git a/datacenterlight/migrations/0019_auto_20180409_1923.py b/datacenterlight/migrations/0019_auto_20180410_1948.py similarity index 97% rename from datacenterlight/migrations/0019_auto_20180409_1923.py rename to datacenterlight/migrations/0019_auto_20180410_1948.py index 4766cb5e..64a13128 100644 --- a/datacenterlight/migrations/0019_auto_20180409_1923.py +++ b/datacenterlight/migrations/0019_auto_20180410_1948.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.9.4 on 2018-04-09 19:23 +# Generated by Django 1.9.4 on 2018-04-10 19:48 from __future__ import unicode_literals from django.db import migrations, models diff --git a/datacenterlight/migrations/0020_auto_20180409_1928.py b/datacenterlight/migrations/0020_auto_20180409_1928.py deleted file mode 100644 index cea83a4c..00000000 --- a/datacenterlight/migrations/0020_auto_20180409_1928.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.4 on 2018-04-09 19:28 -from __future__ import unicode_literals - -from django.db import migrations - -DEFAULT_VMPRICING_NAME='default' - - -def create_default_pricing(apps, schema_editor): - """ - Create default pricing - :param apps: - :param schema_editor: - :return: - """ - VMPricing = apps.get_model('datacenterlight', 'VMPricing') - if not VMPricing.objects.count(): - vm_pricing = VMPricing( - name=DEFAULT_VMPRICING_NAME, - vat_inclusive=True, - cores_unit_price=5, - ram_unit_price=2, - ssd_unit_price=0.6, - hdd_unit_price=0.01, - ) - vm_pricing.save() - - -def undo_vm_pricing(apps, schema_editor): - """Deleting all entries for this model""" - - VMPricing = apps.get_model("datacenterlight", "VMPricing") - VMPricing.objects.all().delete() - - -class Migration(migrations.Migration): - - dependencies = [ - ('datacenterlight', '0019_auto_20180409_1923'), - ] - - operations = [ - migrations.RunPython( - create_default_pricing, - reverse_code=undo_vm_pricing - ), - ]