# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-26 11:35
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    dependencies = [
        ('users', '0022_auto_20160629_1443'),
    ]

    operations = [
        migrations.RunSQL(
            """
                ALTER TABLE "{table_name}"
                   ALTER COLUMN "{column_name}"
                           TYPE jsonb
                          USING regexp_replace("{column_name}"::text, '[\\\\]+u0000', '\\\\\\\\u0000', 'g')::jsonb;
            """.format(
                table_name="users_authdata",
                column_name="extra",
            ),
            reverse_sql=migrations.RunSQL.noop
        ),
    ]
