# -*- coding: utf-8 -*-
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

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

    operations = [
        migrations.CreateModel(
            name='DependencyModel1',
            fields=[
                ('id', models.AutoField(serialize=False, verbose_name='ID', auto_created=True, primary_key=True)),
                ('name', models.CharField(max_length=100)),
                ('original_version', models.ForeignKey(related_name='all_duplicates', to='versionable_testapp.DependencyModel1', null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='DependencyModel2',
            fields=[
                ('id', models.AutoField(serialize=False, verbose_name='ID', auto_created=True, primary_key=True)),
                ('name', models.CharField(max_length=100)),
                ('original_version', models.ForeignKey(related_name='all_duplicates', to='versionable_testapp.DependencyModel2', null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='NonDependencyModel',
            fields=[
                ('id', models.AutoField(serialize=False, verbose_name='ID', auto_created=True, primary_key=True)),
                ('name', models.CharField(max_length=100)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SubDependencyModel1',
            fields=[
                ('id', models.AutoField(serialize=False, verbose_name='ID', auto_created=True, primary_key=True)),
                ('name', models.CharField(max_length=100)),
                ('items', models.ManyToManyField(related_name='links', to='versionable_testapp.NonDependencyModel')),
                ('original_version', models.ForeignKey(related_name='all_duplicates', to='versionable_testapp.SubDependencyModel1', null=True)),
                ('parent', models.ForeignKey(to='versionable_testapp.DependencyModel1')),
                ('parent_version', models.ForeignKey(related_name='direct_duplicates', to='versionable_testapp.SubDependencyModel1', null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='VersionableModel1',
            fields=[
                ('id', models.AutoField(serialize=False, verbose_name='ID', auto_created=True, primary_key=True)),
                ('version_state', models.CharField(default='d', verbose_name='Version state', max_length=1, db_index=True, choices=[('c', 'Copied'), ('C', 'Copying'), ('d', 'Draft'), ('p', 'Published'), ('a', 'Archived')])),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now, verbose_name='Creation date')),
                ('name', models.CharField(max_length=100)),
                ('original_version', models.ForeignKey(related_name='all_duplicates', to='versionable_testapp.VersionableModel1', null=True)),
                ('owner', models.ForeignKey(related_name='versionable_testapp_versionablemodel1_created', to=settings.AUTH_USER_MODEL, verbose_name='Owner')),
                ('parent_version', models.ForeignKey(related_name='direct_duplicates', to='versionable_testapp.VersionableModel1', null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='dependencymodel2',
            name='parent',
            field=models.ForeignKey(to='versionable_testapp.VersionableModel1'),
        ),
        migrations.AddField(
            model_name='dependencymodel2',
            name='parent_version',
            field=models.ForeignKey(related_name='direct_duplicates', to='versionable_testapp.DependencyModel2', null=True),
        ),
        migrations.AddField(
            model_name='dependencymodel1',
            name='parent',
            field=models.ForeignKey(to='versionable_testapp.VersionableModel1'),
        ),
        migrations.AddField(
            model_name='dependencymodel1',
            name='parent_version',
            field=models.ForeignKey(related_name='direct_duplicates', to='versionable_testapp.DependencyModel1', null=True),
        ),
    ]
