# Generated by Django 2.2.1 on 2019-05-16 07:36

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Document',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('uploaded_to', models.FileField(blank=True, upload_to=occupant.models.user_directory_path)),
                ('uploaded_at', models.DateTimeField(auto_now=True)),
                ('occupant_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='document_of', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='TypeDocument',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('description', models.TextField(max_length=250)),
            ],
        ),
        migrations.CreateModel(
            name='Occupant',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_active', models.BooleanField()),
                ('date_of_entry', models.DateField()),
                ('date_of_leaving', models.DateField()),
                ('last_update', models.DateTimeField(auto_now=True)),
                ('creation_date', models.DateTimeField(default=django.utils.timezone.now)),
                ('deposit', models.IntegerField()),
                ('suivi', models.TextField(max_length=250)),
                ('doc_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='documents', to='occupant.Document', verbose_name='related document')),
                ('user_id', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='occupant_of', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='document',
            name='type_doc_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='document_type_of', to='occupant.TypeDocument', verbose_name='related document type'),
        ),
    ]
