# Generated by Django 2.1.2 on 2018-12-12 02:00

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Cidade',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nome', models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='Contato',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('telefone', models.CharField(blank=True, max_length=10, null=True)),
                ('e_mail', models.EmailField(blank=True, max_length=254, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='EntradaDeMaterial',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('lote', models.CharField(max_length=30)),
                ('nota_fiscal', models.PositiveIntegerField(blank=True, null=True, verbose_name='Nota Fiscal')),
                ('data_de_fabricacao', models.DateField(blank=True, null=True, verbose_name='Data de Fabricação')),
                ('data_de_validade', models.DateField(blank=True, null=True, verbose_name='Data de Validade')),
            ],
            options={
                'verbose_name': 'entrada de material',
                'verbose_name_plural': 'entrada de materiais',
            },
        ),
        migrations.CreateModel(
            name='Estado',
            fields=[
                ('sigla', models.CharField(max_length=2, primary_key=True, serialize=False)),
                ('descricao', models.CharField(max_length=20, null=True, verbose_name='descrição')),
            ],
        ),
        migrations.CreateModel(
            name='Fabricante',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('CNPJ', models.CharField(max_length=20, unique=True)),
                ('nome_fantasia', models.CharField(max_length=20, verbose_name='nome fantasia')),
                ('razao_social', models.CharField(max_length=20, verbose_name='razão social')),
                ('logradouro', models.CharField(default='rua', max_length=20)),
                ('nome_do_logradouro', models.CharField(max_length=20, verbose_name='nome do logradouro')),
                ('numero', models.IntegerField(blank=True, verbose_name='número')),
                ('complemento', models.CharField(blank=True, max_length=20)),
                ('bairro', models.CharField(max_length=20)),
                ('cep', models.CharField(max_length=9)),
                ('cidade', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Cidade')),
            ],
        ),
        migrations.CreateModel(
            name='Material',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nome', models.CharField(max_length=50)),
                ('descricao', models.CharField(max_length=300, null=True, verbose_name='descrição')),
                ('unidade', models.CharField(max_length=4)),
                ('quantidade', models.FloatField(blank=True, null=True)),
            ],
            options={
                'verbose_name': 'material',
                'verbose_name_plural': 'materiais',
            },
        ),
        migrations.CreateModel(
            name='TipodeMaterial',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('descricao', models.CharField(max_length=30, null=True, verbose_name='descrição')),
            ],
            options={
                'verbose_name': 'tipo de material',
                'verbose_name_plural': 'tipos de materiais',
            },
        ),
        migrations.AddField(
            model_name='material',
            name='tipo_de_material',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.TipodeMaterial', verbose_name='tipo do material'),
        ),
        migrations.AddField(
            model_name='entradadematerial',
            name='fabricante',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='core.Fabricante'),
        ),
        migrations.AddField(
            model_name='entradadematerial',
            name='material',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='core.Material'),
        ),
        migrations.AddField(
            model_name='contato',
            name='fabricante',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Fabricante'),
        ),
        migrations.AddField(
            model_name='cidade',
            name='estado',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='core.Estado'),
        ),
        migrations.AlterUniqueTogether(
            name='entradadematerial',
            unique_together={('material', 'lote')},
        ),
        migrations.AlterUniqueTogether(
            name='contato',
            unique_together={('telefone', 'e_mail', 'fabricante')},
        ),
    ]
