# Generated by Django 3.2.6 on 2021-08-23 02:37

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='ModelWithConstraint',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=10)),
                ('date', models.DateField(max_length=10)),
            ],
        ),
        migrations.CreateModel(
            name='ModelWithSingleUniqueField',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=10, unique=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='NaturalKeyParent',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=10)),
                ('group', models.CharField(max_length=10)),
            ],
            options={
                'unique_together': {('code', 'group')},
            },
        ),
        migrations.CreateModel(
            name='NaturalKeyChild',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('mode', models.CharField(max_length=10)),
                ('parent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='test_app.naturalkeyparent')),
            ],
        ),
        migrations.CreateModel(
            name='ModelWithNaturalKey',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.CharField(max_length=10)),
                ('key', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='test_app.naturalkeychild')),
            ],
        ),
        migrations.CreateModel(
            name='ModelWithExtraField',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=10)),
                ('date', models.DateField(max_length=10)),
                ('extra', models.TextField()),
            ],
            options={
                'unique_together': {('code', 'date')},
            },
        ),
        migrations.AddConstraint(
            model_name='modelwithconstraint',
            constraint=models.UniqueConstraint(fields=('code', 'date'), name='natural key'),
        ),
        migrations.AlterUniqueTogether(
            name='naturalkeychild',
            unique_together={('parent', 'mode')},
        ),
    ]
