# Generated by Django 3.0.7 on 2020-07-13 15:17

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Cargo',
            fields=[
                ('id_cargo', models.IntegerField(primary_key=True, serialize=False)),
                ('descripcion_cargo', models.CharField(max_length=50)),
            ],
            options={
                'db_table': 'cargo',
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='Carro',
            fields=[
                ('id_carro', models.IntegerField(primary_key=True, serialize=False)),
                ('total', models.IntegerField()),
            ],
            options={
                'db_table': 'carro',
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='Ciudad',
            fields=[
                ('id_ciudad', models.IntegerField(primary_key=True, serialize=False)),
                ('descripcion_ciudad', models.CharField(max_length=50)),
            ],
            options={
                'db_table': 'ciudad',
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='Comuna',
            fields=[
                ('id_comuna', models.IntegerField(primary_key=True, serialize=False)),
                ('descripcion_comuna', models.CharField(max_length=50)),
            ],
            options={
                'db_table': 'comuna',
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='FamilyProduct',
            fields=[
                ('id_family', models.IntegerField(primary_key=True, serialize=False)),
                ('desc_family', models.CharField(max_length=20)),
            ],
            options={
                'db_table': 'family_product',
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='Producto',
            fields=[
                ('id_producto', models.BigIntegerField(primary_key=True, serialize=False)),
                ('descripcion', models.CharField(max_length=100)),
                ('precio', models.IntegerField()),
                ('stock', models.IntegerField()),
                ('stock_critico', models.IntegerField()),
                ('fk_id_familia', models.IntegerField()),
            ],
            options={
                'db_table': 'producto',
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='TipoProduct',
            fields=[
                ('id_product', models.IntegerField(primary_key=True, serialize=False)),
                ('desc_product', models.CharField(max_length=40)),
            ],
            options={
                'db_table': 'tipo_product',
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='TipoVenta',
            fields=[
                ('id_tipo_venta', models.BooleanField(primary_key=True, serialize=False)),
                ('descripcion_tipo_vena', models.CharField(max_length=50)),
            ],
            options={
                'db_table': 'tipo_venta',
                'managed': False,
            },
        ),
        migrations.CreateModel(
            name='Cliente',
            fields=[
                ('id_cliente', models.IntegerField(primary_key=True, serialize=False)),
                ('user_cliente', models.CharField(max_length=50)),
                ('pass_cliente', models.CharField(max_length=50)),
                ('direccion_calle', models.CharField(blank=True, max_length=50, null=True)),
                ('direccion_numero', models.IntegerField(blank=True, null=True)),
                ('email', models.CharField(blank=True, max_length=35, null=True)),
                ('telefono', models.IntegerField(blank=True, null=True)),
                ('comuna_id_ciudad', models.IntegerField(blank=True, null=True)),
                ('carro_id_carro', models.ForeignKey(db_column='carro_id_carro', on_delete=django.db.models.deletion.DO_NOTHING, to='home.Carro')),
                ('comuna_id_comuna', models.ForeignKey(blank=True, db_column='comuna_id_comuna', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='home.Comuna')),
            ],
            options={
                'db_table': 'cliente',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Empresa',
            fields=[
                ('rut_empresa', models.IntegerField(primary_key=True, serialize=False)),
                ('dv_empresa', models.CharField(max_length=2)),
                ('nombre_empresa', models.CharField(max_length=50)),
                ('rol_empresa', models.CharField(max_length=50)),
            ],
            options={
                'db_table': 'empresa',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Funcionario',
            fields=[
                ('rut_funcionario', models.IntegerField(primary_key=True, serialize=False)),
                ('dv_funcionario', models.CharField(max_length=2)),
                ('nombre_funcionario', models.CharField(max_length=50)),
                ('apellido_funcionario', models.CharField(max_length=50)),
                ('user_funcionario', models.CharField(max_length=50)),
                ('pass_funcionario', models.CharField(max_length=50)),
                ('cargo_id_cargo', models.ForeignKey(db_column='cargo_id_cargo', on_delete=django.db.models.deletion.DO_NOTHING, to='home.Cargo')),
            ],
            options={
                'db_table': 'funcionario',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='PersonaNatural',
            fields=[
                ('rut_natural', models.IntegerField(primary_key=True, serialize=False)),
                ('dv_natural', models.CharField(max_length=2)),
                ('nombre_natural', models.CharField(max_length=50)),
                ('apellido_natural', models.CharField(max_length=50)),
            ],
            options={
                'db_table': 'persona_natural',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Proveedor',
            fields=[
                ('id_proveedor', models.IntegerField(primary_key=True, serialize=False)),
                ('nombre_proveedor', models.CharField(max_length=25)),
                ('fono', models.BigIntegerField()),
                ('rubro', models.CharField(max_length=50)),
                ('user_proveedor', models.CharField(max_length=50)),
                ('pass_proveedor', models.CharField(max_length=50)),
            ],
            options={
                'db_table': 'proveedor',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Imagen',
            fields=[
                ('producto_id_producto', models.OneToOneField(db_column='producto_id_producto', on_delete=django.db.models.deletion.DO_NOTHING, primary_key=True, serialize=False, to='home.Producto')),
                ('direccion_imagen', models.CharField(max_length=500)),
            ],
            options={
                'db_table': 'imagen',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Venta',
            fields=[
                ('id_venta', models.BigAutoField(primary_key=True, serialize=False)),
                ('fecha_venta', models.DateField(auto_now_add=True)),
                ('total', models.IntegerField()),
                ('es_nula', models.CharField(max_length=1)),
                ('cliente_id_cliente', models.ForeignKey(blank=True, db_column='cliente_id_cliente', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='home.Cliente')),
                ('funcionario_rut_funcionario', models.ForeignKey(db_column='funcionario_rut_funcionario', on_delete=django.db.models.deletion.DO_NOTHING, to='home.Funcionario')),
                ('tipo_venta_id_tipo_venta', models.ForeignKey(db_column='tipo_venta_id_tipo_venta', on_delete=django.db.models.deletion.DO_NOTHING, to='home.TipoVenta')),
            ],
            options={
                'db_table': 'venta',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='OrdenDeCompra',
            fields=[
                ('id_orden', models.IntegerField(primary_key=True, serialize=False)),
                ('fecha', models.DateField()),
                ('total', models.IntegerField()),
                ('es_nula', models.CharField(max_length=1)),
                ('funcionario_rut_funcionario', models.ForeignKey(db_column='funcionario_rut_funcionario', on_delete=django.db.models.deletion.DO_NOTHING, to='home.Funcionario')),
                ('proveedor_id_proveedor', models.ForeignKey(db_column='proveedor_id_proveedor', on_delete=django.db.models.deletion.DO_NOTHING, to='home.Proveedor')),
            ],
            options={
                'db_table': 'orden_de_compra',
                'managed': True,
                'unique_together': {('id_orden', 'proveedor_id_proveedor')},
            },
        ),
        migrations.CreateModel(
            name='DetalleVenta',
            fields=[
                ('id_detalle_venta', models.BigAutoField(primary_key=True, serialize=False)),
                ('cantidad', models.IntegerField()),
                ('venta_id_tipo_venta', models.BooleanField()),
                ('producto_id_producto', models.ForeignKey(db_column='producto_id_producto', on_delete=django.db.models.deletion.DO_NOTHING, to='home.Producto')),
                ('venta_id_venta', models.ForeignKey(db_column='venta_id_venta', on_delete=django.db.models.deletion.DO_NOTHING, to='home.Venta')),
            ],
            options={
                'db_table': 'detalle_venta',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='DetalleOrdenDeCompra',
            fields=[
                ('id_detalle', models.IntegerField(primary_key=True, serialize=False)),
                ('cantidad', models.IntegerField()),
                ('precio_compra', models.IntegerField()),
                ('fk_id_proveedor', models.ForeignKey(db_column='fk_id_proveedor', on_delete=django.db.models.deletion.DO_NOTHING, related_name='fk_det_a_prov', to='home.OrdenDeCompra')),
                ('fk_orden', models.ForeignKey(db_column='fk_orden', on_delete=django.db.models.deletion.DO_NOTHING, to='home.OrdenDeCompra')),
                ('fk_producto', models.ForeignKey(db_column='fk_producto', on_delete=django.db.models.deletion.DO_NOTHING, to='home.Producto')),
            ],
            options={
                'db_table': 'detalle_orden_de_compra',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='DetalleCarro',
            fields=[
                ('id_detalle_carro', models.IntegerField(primary_key=True, serialize=False)),
                ('cantidad', models.IntegerField()),
                ('carro_id_carro', models.ForeignKey(db_column='carro_id_carro', on_delete=django.db.models.deletion.DO_NOTHING, to='home.Carro')),
                ('producto_id_producto', models.ForeignKey(db_column='producto_id_producto', on_delete=django.db.models.deletion.DO_NOTHING, to='home.Producto')),
            ],
            options={
                'db_table': 'detalle_carro',
                'managed': True,
            },
        ),
        migrations.AddField(
            model_name='cliente',
            name='empresa_rut_empresa',
            field=models.ForeignKey(blank=True, db_column='empresa_rut_empresa', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='home.Empresa'),
        ),
        migrations.AddField(
            model_name='cliente',
            name='persona_natural_rut_natural',
            field=models.ForeignKey(blank=True, db_column='persona_natural_rut_natural', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='home.PersonaNatural'),
        ),
    ]
