# Generated by Django 3.1.1 on 2020-10-01 18:31

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


class Migration(migrations.Migration):

    dependencies = [
        ('core', '0002_mapacampos_regra_conversao'),
    ]

    operations = [
        migrations.CreateModel(
            name='Apontamento',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('data_apontamento', models.DateField(verbose_name='Data do Apontamento')),
                ('hora_inicial', models.TimeField(verbose_name='Hora inicial')),
                ('hora_final', models.TimeField(verbose_name='Hora Final')),
                ('descricao', models.CharField(max_length=255, verbose_name='Atividade')),
                ('data_criacao', models.DateTimeField(auto_now_add=True, verbose_name='Stamp de criação')),
                ('data_alteracao', models.DateTimeField(auto_now=True, verbose_name='Stamp de alteração')),
            ],
            options={
                'verbose_name_plural': 'apontamentos',
                'db_table': 'apontamento',
            },
        ),
        migrations.CreateModel(
            name='Cliente',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nome', models.CharField(max_length=50, unique=True, verbose_name='Nome do Cliente')),
            ],
            options={
                'verbose_name_plural': 'clientes',
                'db_table': 'cliente',
            },
        ),
        migrations.CreateModel(
            name='Fornecedor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nome', models.CharField(max_length=50, unique=True, verbose_name='Nome do Fornecedor')),
            ],
            options={
                'verbose_name_plural': 'fornecedores',
                'db_table': 'fornecedor',
            },
        ),
        migrations.CreateModel(
            name='Periodo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nome', models.CharField(max_length=30, unique=True, verbose_name='Nome do Período')),
                ('hora_inicial', models.DateTimeField(verbose_name='Início')),
                ('hora_final', models.DateTimeField(verbose_name='Fim')),
                ('status', models.CharField(choices=[('O', 'Aberto'), ('F', 'Fechado')], default='F', max_length=1, verbose_name='Status')),
            ],
        ),
        migrations.CreateModel(
            name='Recurso',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nome', models.CharField(max_length=50, verbose_name='Nome')),
                ('fornecedor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.fornecedor')),
            ],
            options={
                'verbose_name_plural': 'recursos',
                'db_table': 'recurso',
            },
        ),
        migrations.CreateModel(
            name='Projeto',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nome', models.CharField(max_length=50, verbose_name='Nome do Projeto')),
                ('descricao', models.TextField(verbose_name='Descrição do Projeto')),
                ('status', models.CharField(choices=[('A', 'Ativo'), ('I', 'Inativo'), ('C', 'Cancelado')], default='I', max_length=1, verbose_name='Status')),
                ('cliente', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.cliente')),
            ],
            options={
                'verbose_name_plural': 'projetos',
                'db_table': 'projeto',
            },
        ),
        migrations.AddIndex(
            model_name='fornecedor',
            index=models.Index(fields=['nome'], name='fornecedor_nome_idx'),
        ),
        migrations.AddIndex(
            model_name='cliente',
            index=models.Index(fields=['nome'], name='cliente_nome_idx'),
        ),
        migrations.AddField(
            model_name='apontamento',
            name='periodo',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='core.periodo'),
        ),
        migrations.AddField(
            model_name='apontamento',
            name='projeto',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='core.projeto'),
        ),
        migrations.AddField(
            model_name='apontamento',
            name='recurso',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='core.recurso'),
        ),
        migrations.AddIndex(
            model_name='recurso',
            index=models.Index(fields=['nome'], name='recurso_nome_idx'),
        ),
        migrations.AddIndex(
            model_name='projeto',
            index=models.Index(fields=['nome'], name='projeto_nome_idx'),
        ),
        migrations.AddIndex(
            model_name='apontamento',
            index=models.Index(fields=['-data_apontamento', '-hora_inicial'], name='apontamento_idx'),
        ),
    ]
