# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-12 14:59
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Change',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')),
                ('action', models.CharField(choices=[('delchange', 'delete change'), ('create', 'create object'), ('delete', 'delete object'), ('update', 'update attribute'), ('m2m_add', 'add many to many relation'), ('m2m_remove', 'add many to many relation')], max_length=16, verbose_name='action')),
                ('model_name', models.CharField(max_length=50, null=True, verbose_name='model name')),
                ('existing_object_pk', models.PositiveIntegerField(null=True, verbose_name='id of existing object')),
                ('field_name', models.CharField(max_length=50, null=True, verbose_name='field name')),
                ('field_value', models.TextField(null=True, verbose_name='new field value')),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='changes', to=settings.AUTH_USER_MODEL, verbose_name='Author')),
            ],
            options={
                'verbose_name': 'Change',
                'verbose_name_plural': 'Changes',
                'default_related_name': 'changes',
            },
        ),
        migrations.CreateModel(
            name='ChangeSet',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')),
                ('proposed', models.DateTimeField(null=True, verbose_name='proposed')),
                ('applied', models.DateTimeField(null=True, verbose_name='applied')),
                ('applied_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='applied_changesets', to=settings.AUTH_USER_MODEL, verbose_name='applied by')),
                ('author', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='changesets', to=settings.AUTH_USER_MODEL, verbose_name='Author')),
            ],
            options={
                'verbose_name': 'Change Set',
                'verbose_name_plural': 'Change Sets',
                'default_related_name': 'changesets',
            },
        ),
        migrations.AddField(
            model_name='change',
            name='changeset',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='changes', to='editor.ChangeSet', verbose_name='Change Set'),
        ),
        migrations.AddField(
            model_name='change',
            name='created_object',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='changed_by', to='editor.Change', verbose_name='changed object'),
        ),
        migrations.AddField(
            model_name='change',
            name='deletes_change',
            field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='deleted_by', to='editor.Change', verbose_name='deletes change'),
        ),
    ]
