text: # -*- coding: utf-8 -*-
  # Generated by Django 1.11 on 2017-09-07 23:51
  from __future__ import unicode_literals
  
  from django.db import migrations
  from django.db import migrations, models, transaction
  import json
  
  def migrate(apps, schema_editor):
      Chart = apps.get_model('grapher_admin', 'Chart')
      Variable = apps.get_model('grapher_admin', 'Variable')
      with transaction.atomic():
          for chart in Chart.objects.all():
              config = json.loads(chart.config)
  
              if 'map' in config:
                  mapConfig = config['map']
                  if not mapConfig.get('colorSchemeValuesAutomatic', False):
                      mapConfig['isManualBuckets'] = True
                  if 'colorSchemeValuesAutomatic' in mapConfig:
                      del mapConfig['colorSchemeValuesAutomatic']
              
              chart.config = json.dumps(config)
              chart.save()
  
  
  
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('grapher_admin', '0008_blank_to_undefined_20170906_2337'),
      ]
  
      operations = [
          migrations.RunPython(migrate)
      ]
  