# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-05-07 16:20
from __future__ import unicode_literals

import django.contrib.postgres.fields.jsonb
from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [
        ('councilmatic_core', '0040_mediaevent_meta'),
    ]

    operations = [
        migrations.AddField(
            model_name='event',
            name='extras',
            field=django.contrib.postgres.fields.jsonb.JSONField(default=dict),
        ),
        migrations.RunSQL('''
            UPDATE councilmatic_core_event
              SET extras = json_build_object('guid', guid)::jsonb
              WHERE guid IS NOT NULL
        ''', reverse_sql='''
            UPDATE councilmatic_core_event
              SET guid = extras->>'guid'
              WHERE extras->'guid' IS NOT NULL
        '''),
        migrations.RemoveField(
            model_name='event',
            name='guid',
        ),
    ]
