# -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-07-02 12:41
from __future__ import unicode_literals

from django.db import migrations, models
from django.conf import settings


class Migration(migrations.Migration):

    dependencies = [
        ('news', '0004_tag_permissions'),
    ]

    operations = [
        migrations.AddField(
            model_name='newsarticle',
            name='modstate',
            field=models.IntegerField(choices=[(0, 'Created (submitter edits)'), (1, 'Pending moderation'), (2, 'Approved and published')], default=0, verbose_name='Moderation state'),
        ),
        migrations.RunSQL(
            "UPDATE news_newsarticle SET modstate=CASE WHEN approved THEN 2 ELSE 0 END",
            "UPDATE news_newsarticle SET approved=(modstate = 2)",
        ),
        migrations.RemoveField(
            model_name='newsarticle',
            name='approved',
        ),
        migrations.AddField(
            model_name='newsarticle',
            name='firstmoderator',
            field=models.ForeignKey(to=settings.AUTH_USER_MODEL, null=True, blank=True, on_delete=models.SET_NULL),
        ),
    ]
