# Generated by Django 3.1.3 on 2020-11-22 06:00

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Case',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('case_num', models.IntegerField()),
                ('confirm_date', models.DateField()),
                ('case_class', models.CharField(choices=[('Local', 'Local'), ('Imported', 'Imported')], max_length=10)),
            ],
        ),
        migrations.CreateModel(
            name='Locations',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('place_name', models.CharField(max_length=200, unique=True)),
                ('address', models.CharField(max_length=200)),
                ('x_coord', models.FloatField()),
                ('y_coord', models.FloatField()),
            ],
        ),
        migrations.CreateModel(
            name='Patient',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200)),
                ('id_num', models.CharField(max_length=10, unique=True)),
                ('birth_date', models.DateField()),
            ],
        ),
        migrations.CreateModel(
            name='Virus',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('virus', models.CharField(max_length=20, unique=True)),
                ('disease', models.CharField(max_length=20)),
                ('inf_period', models.IntegerField()),
            ],
        ),
        migrations.CreateModel(
            name='Visit_Info',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('date_from', models.DateField()),
                ('date_to', models.DateField()),
                ('category', models.CharField(max_length=20)),
                ('case_visit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='location.case')),
                ('location_visit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='location.locations')),
            ],
        ),
        migrations.AddField(
            model_name='case',
            name='infection',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='location.virus'),
        ),
        migrations.AddField(
            model_name='case',
            name='patient',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='location.patient'),
        ),
        migrations.AddField(
            model_name='case',
            name='visited',
            field=models.ManyToManyField(through='location.Visit_Info', to='location.Locations'),
        ),
        migrations.AlterUniqueTogether(
            name='case',
            unique_together={('infection', 'case_num')},
        ),
    ]
