<commit_before># -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json

from django.db import models, migrations
from datapoints.models import CustomDashboard, CustomChart
import jsonfield.fields


class Migration(migrations.Migration):


    dependencies = [
        ('datapoints', '0016_remove_datapoint_abstracted'),
    ]

    operations = [
        migrations.RunPyhon('''
        DROP TABLE IF EXISTS _campaign_fix_naija;
        CREATE TABLE _campaign_fix_naija (
            slug VARCHAR,
            new_date DATE
        );

        INSERT INTO _campaign_fix_naija
        (slug, new_date)

        SELECT 'nigeria-april-2013','2013-04-01' UNION ALL
        SELECT 'nigeria-august-2013','2013-08-01' UNION ALL
        SELECT 'nigeria-december-2013','2013-12-01' UNION ALL
        SELECT 'nigeria-february-2013','2013-02-01' UNION ALL
        SELECT 'nigeria-january-2013','2013-01-01' UNION ALL
        SELECT 'nigeria-july-2013','2013-07-01' UNION ALL
        SELECT 'nigeria-june-2013','2013-06-01' UNION ALL
        SELECT 'nigeria-march-2013','2013-03-01' UNION ALL
        SELECT 'nigeria-may-2013','2013-05-01' UNION ALL
        SELECT 'nigeria-november-2013','2013-11-01' UNION ALL
        SELECT 'nigeria-october-2013','2013-10-01' UNION ALL
        SELECT 'nigeria-september-2013','2013-09-01';

        UPDATE campaign c
        SET start_date = f.new_date
        FROM _campaign_fix_naija f
        WHERE c.slug = f.slug;

        DROP TABLE IF EXISTS _campaign_fix_naija;
        '''),
    ]<commit_msg>properly cast campaign start_date<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json

from django.db import models, migrations
from datapoints.models import CustomDashboard, CustomChart
import jsonfield.fields


class Migration(migrations.Migration):


    dependencies = [
        ('datapoints', '0016_remove_datapoint_abstracted'),
    ]

    operations = [
        migrations.RunSQL('''
        DROP TABLE IF EXISTS _campaign_fix_naija;
        CREATE TABLE _campaign_fix_naija (
            slug VARCHAR,
            new_date VARCHAR
        );

        INSERT INTO _campaign_fix_naija
        (slug, new_date)

        SELECT 'nigeria-april-2013','2013-04-01' UNION ALL
        SELECT 'nigeria-august-2013','2013-08-01' UNION ALL
        SELECT 'nigeria-december-2013','2013-12-01' UNION ALL
        SELECT 'nigeria-february-2013','2013-02-01' UNION ALL
        SELECT 'nigeria-january-2013','2013-01-01' UNION ALL
        SELECT 'nigeria-july-2013','2013-07-01' UNION ALL
        SELECT 'nigeria-june-2013','2013-06-01' UNION ALL
        SELECT 'nigeria-march-2013','2013-03-01' UNION ALL
        SELECT 'nigeria-may-2013','2013-05-01' UNION ALL
        SELECT 'nigeria-november-2013','2013-11-01' UNION ALL
        SELECT 'nigeria-october-2013','2013-10-01' UNION ALL
        SELECT 'nigeria-september-2013','2013-09-01';

        UPDATE campaign c
        SET start_date = CAST(f.new_date AS DATE)
        FROM _campaign_fix_naija f
        WHERE c.slug = f.slug;

        DROP TABLE IF EXISTS _campaign_fix_naija;
        '''),
    ]
{'fraction_non_alphanumeric': 0.1088, 'fraction_numerical': 0.09536, 'mean_word_length': 2.6013824884792625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3100097', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1024, 'n_words': 221}