# Generated by Django 3.1 on 2020-08-25 11:35

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Address',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='name')),
                ('zip', models.IntegerField(verbose_name='zip/postal code')),
            ],
            options={
                'verbose_name': 'address',
                'verbose_name_plural': 'addresses',
            },
        ),
        migrations.CreateModel(
            name='Company',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='name')),
            ],
            options={
                'verbose_name': 'company',
                'verbose_name_plural': 'companies',
            },
        ),
        migrations.CreateModel(
            name='State',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True, verbose_name='name')),
            ],
            options={
                'verbose_name': 'state',
                'verbose_name_plural': 'states',
            },
        ),
        migrations.CreateModel(
            name='Person',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_name', models.CharField(max_length=255, verbose_name='first name')),
                ('last_name', models.CharField(max_length=255, verbose_name='last name')),
                ('phone', models.CharField(max_length=255, verbose_name='phone')),
                ('email', models.EmailField(max_length=255, verbose_name='email')),
                ('web', models.URLField(max_length=255, verbose_name='web')),
                ('address', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='persons', to='people.address', verbose_name='address')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='persons', to='people.company', verbose_name='company')),
            ],
            options={
                'verbose_name': 'person',
                'verbose_name_plural': 'persons',
            },
        ),
        migrations.CreateModel(
            name='County',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, unique=True, verbose_name='name')),
                ('state', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='counties', to='people.state', verbose_name='state')),
            ],
            options={
                'verbose_name': 'county',
                'verbose_name_plural': 'counties',
                'unique_together': {('name', 'state')},
            },
        ),
        migrations.CreateModel(
            name='City',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255, verbose_name='name')),
                ('county', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cities', to='people.county', verbose_name='county')),
                ('state', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cities', to='people.state', verbose_name='state')),
            ],
            options={
                'verbose_name': 'city',
                'verbose_name_plural': 'cities',
                'unique_together': {('name', 'state', 'county')},
            },
        ),
        migrations.AddField(
            model_name='address',
            name='city',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='addresses', to='people.city', verbose_name='city'),
        ),
        migrations.AlterUniqueTogether(
            name='address',
            unique_together={('name', 'city')},
        ),
    ]
