# Generated by Django 3.1 on 2020-08-12 15:20

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(db_column='user_id', primary_key=True, serialize=False)),
                ('firstName', models.CharField(db_column='first_name', max_length=30)),
                ('lastName', models.CharField(db_column='last_name', max_length=30)),
                ('nick_name', models.CharField(db_column='nick_name', max_length=20, unique=True)),
                ('password', models.TextField()),
                ('salt', models.TextField()),
                ('statusId', models.IntegerField(db_column='state_id')),
                ('createdDate', models.FloatField(blank=True, db_column='created', null=True)),
                ('updatedDate', models.FloatField(blank=True, db_column='updated', null=True)),
                ('date_of_birth', models.DateField(blank=True, null=True)),
                ('picture', models.ImageField(blank=True, null=True, upload_to='')),
                ('is_staff', models.BooleanField(default=False)),
                ('is_active', models.BooleanField(default=True)),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now)),
                ('last_login', models.DateTimeField(null=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='DowntimeType',
            fields=[
                ('id', models.AutoField(db_column='downtime_type_id', primary_key=True, serialize=False)),
                ('name', models.CharField(db_column='downtime_type_name', max_length=45)),
                ('description', models.CharField(db_column='downtime_type_description', max_length=45)),
                ('subject', models.CharField(db_column='downtime_type', max_length=45)),
                ('statusId', models.CharField(db_column='downtime_active', max_length=9)),
            ],
            options={
                'db_table': 'downtime_type',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Item',
            fields=[
                ('id', models.AutoField(db_column='item_id', primary_key=True, serialize=False)),
                ('code', models.CharField(db_column='items_code', max_length=45)),
                ('description', models.CharField(db_column='item_description', max_length=45)),
                ('statusId', models.IntegerField(db_column='item_active')),
            ],
            options={
                'db_table': 'items',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Machine',
            fields=[
                ('id', models.AutoField(db_column='machine_id', primary_key=True, serialize=False)),
                ('name', models.CharField(db_column='machine_name', max_length=9)),
                ('statusId', models.IntegerField(db_column='machine_active')),
            ],
            options={
                'db_table': 'machines',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='OrderDetails',
            fields=[
                ('id', models.IntegerField(db_column='detail_id', primary_key=True, serialize=False)),
                ('orderId', models.IntegerField(db_column='order_id')),
                ('quantity', models.IntegerField()),
                ('quantityReceived', models.IntegerField(blank=True, db_column='quantity_received', null=True)),
                ('receivedDate', models.FloatField(blank=True, db_column='received_date', null=True)),
                ('insertedDate', models.FloatField(blank=True, db_column='inserted', null=True)),
                ('itemId', models.ForeignKey(db_column='item', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.item')),
            ],
            options={
                'db_table': 'order_details',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='OrderStatus',
            fields=[
                ('id', models.AutoField(db_column='order_status_id', primary_key=True, serialize=False)),
                ('description', models.CharField(db_column='order_status_description', max_length=45)),
                ('statusId', models.IntegerField(db_column='order_status_active')),
            ],
            options={
                'db_table': 'order_status',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='ProductionStatus',
            fields=[
                ('id', models.AutoField(db_column='production_status_id', primary_key=True, serialize=False)),
                ('description', models.CharField(db_column='production_status_description', max_length=45)),
                ('statusId', models.IntegerField(db_column='production_status_active')),
            ],
            options={
                'db_table': 'production_status',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Schedule',
            fields=[
                ('id', models.AutoField(db_column='schedule_id', primary_key=True, serialize=False)),
                ('orderItemProcess', models.CharField(db_column='order_item_process', max_length=15)),
                ('manufacturingDate', models.FloatField(db_column='manufacturing_date')),
                ('creationDate', models.FloatField(db_column='creation_date')),
                ('quantity', models.IntegerField(db_column='order_quantity')),
                ('detailId', models.ForeignKey(db_column='detail', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.orderdetails')),
                ('statusId', models.ForeignKey(db_column='status', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.productionstatus')),
            ],
            options={
                'db_table': 'schedule',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='ProductsProcesses',
            fields=[
                ('id', models.AutoField(db_column='product_processes_id', primary_key=True, serialize=False)),
                ('stdTime', models.IntegerField(db_column='product_processes_std_time')),
                ('statusId', models.IntegerField(db_column='product_processes_active')),
                ('fromStatusId', models.ForeignKey(db_column='from_status_id', on_delete=django.db.models.deletion.DO_NOTHING, related_name='product_from_status', to='appRESTFul.productionstatus')),
                ('itemId', models.ForeignKey(db_column='item_id', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.item')),
                ('machineId', models.ForeignKey(db_column='machine_id', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.machine')),
                ('toStatusId', models.ForeignKey(db_column='to_status_id', on_delete=django.db.models.deletion.DO_NOTHING, related_name='product_to_status', to='appRESTFul.productionstatus')),
            ],
            options={
                'db_table': 'products_processes',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='ProductionHistory',
            fields=[
                ('id', models.AutoField(db_column='production_id', primary_key=True, serialize=False)),
                ('startTime', models.FloatField(db_column='production_start_time')),
                ('finishTime', models.FloatField(db_column='production_finish_time')),
                ('unitsManufactured', models.IntegerField(db_column='production_units_manufactured')),
                ('detailId', models.ForeignKey(db_column='detail', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.orderdetails')),
                ('itemId', models.ForeignKey(db_column='item', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.item')),
                ('statusId', models.ForeignKey(db_column='status', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.productionstatus')),
                ('userId', models.ForeignKey(db_column='user', on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'production_history',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Production',
            fields=[
                ('id', models.AutoField(db_column='production_id', primary_key=True, serialize=False)),
                ('startTime', models.FloatField(db_column='production_start_time')),
                ('finishTime', models.FloatField(db_column='production_finish_time')),
                ('unitsManufactured', models.IntegerField(db_column='production_units_manufactured')),
                ('detailId', models.ForeignKey(db_column='detail', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.orderdetails')),
                ('itemId', models.ForeignKey(db_column='item', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.item')),
                ('statusId', models.ForeignKey(db_column='status', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.productionstatus')),
                ('userId', models.ForeignKey(db_column='user', on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'production',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='OrdersHistory',
            fields=[
                ('id', models.AutoField(db_column='order_id', primary_key=True, serialize=False)),
                ('orderNumber', models.CharField(db_column='order_number', max_length=15)),
                ('itemId', models.IntegerField(db_column='item_id')),
                ('customerName', models.CharField(db_column='order_customer_name', max_length=50)),
                ('dueDate', models.FloatField(db_column='order_due_date')),
                ('newDueDate', models.FloatField(blank=True, db_column='order_new_due_date', null=True)),
                ('quantity', models.IntegerField(db_column='order_quantity')),
                ('quantityReceived', models.IntegerField(blank=True, db_column='order_quantity_received', null=True)),
                ('receivedDate', models.FloatField(blank=True, db_column='order_received_date', null=True)),
                ('scheduleTime', models.FloatField(blank=True, db_column='schedule_time', null=True)),
                ('statusId', models.ForeignKey(blank=True, db_column='order_status', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.orderstatus')),
            ],
            options={
                'db_table': 'orders_history',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.IntegerField(db_column='order_id', primary_key=True, serialize=False)),
                ('customerName', models.CharField(db_column='order_customer_name', max_length=50)),
                ('dueDate', models.FloatField(db_column='order_due_date')),
                ('partiallyCancel', models.IntegerField(blank=True, db_column='partially_cancel', null=True)),
                ('isBackOrder', models.IntegerField(blank=True, db_column='is_back_order', null=True)),
                ('createdDate', models.FloatField(blank=True, db_column='created', null=True)),
                ('modifiedDate', models.FloatField(blank=True, db_column='modified', null=True)),
                ('insertedDate', models.FloatField(blank=True, db_column='inserted', null=True)),
                ('priorityStatusId', models.IntegerField(blank=True, db_column='priority_status', null=True)),
                ('statusId', models.ForeignKey(blank=True, db_column='order_status', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.orderstatus')),
            ],
            options={
                'db_table': 'orders',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='MachineUser',
            fields=[
                ('id', models.AutoField(db_column='machine_user_id', primary_key=True, serialize=False)),
                ('statusId', models.IntegerField(db_column='machine_user_active')),
                ('machineId', models.ForeignKey(db_column='machine', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.machine')),
                ('userId', models.ForeignKey(db_column='user', on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'machine_user',
                'managed': True,
            },
        ),
        migrations.AddField(
            model_name='machine',
            name='statusIdPrimary',
            field=models.ForeignKey(db_column='status_id_primary_rm', on_delete=django.db.models.deletion.DO_NOTHING, related_name='machines_primary_status_id', to='appRESTFul.productionstatus'),
        ),
        migrations.AddField(
            model_name='machine',
            name='statusIdSecondary',
            field=models.ForeignKey(db_column='status_id_secondary_rm', on_delete=django.db.models.deletion.DO_NOTHING, related_name='machines_secondary_status_id', to='appRESTFul.productionstatus'),
        ),
        migrations.CreateModel(
            name='DowntimesHistory',
            fields=[
                ('id', models.AutoField(db_column='downtime_id', primary_key=True, serialize=False)),
                ('startTime', models.FloatField(db_column='downtime_start_time')),
                ('finishTime', models.FloatField(db_column='downtime_finish_time')),
                ('detailId', models.ForeignKey(db_column='detail', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.orderdetails')),
                ('downtimeTypeId', models.ForeignKey(db_column='downtime_type', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.downtimetype')),
                ('itemId', models.ForeignKey(db_column='item', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.item')),
                ('statusId', models.ForeignKey(db_column='status', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.productsprocesses')),
                ('userId', models.ForeignKey(db_column='user', on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'downtimes_history',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='Downtime',
            fields=[
                ('id', models.AutoField(db_column='downtime_id', primary_key=True, serialize=False)),
                ('startTime', models.FloatField(db_column='downtime_start_time')),
                ('finishTime', models.FloatField(db_column='downtime_finish_time')),
                ('detailId', models.ForeignKey(db_column='detail', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.orderdetails')),
                ('downtimeTypeId', models.ForeignKey(db_column='downtime_type', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.downtimetype')),
                ('itemId', models.ForeignKey(db_column='item', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.item')),
                ('statusId', models.ForeignKey(db_column='status', on_delete=django.db.models.deletion.DO_NOTHING, to='appRESTFul.productsprocesses')),
                ('userId', models.ForeignKey(db_column='user', on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'db_table': 'downtimes',
                'managed': True,
            },
        ),
        migrations.CreateModel(
            name='ChangeoverCost',
            fields=[
                ('id', models.AutoField(db_column='changeover_cost_id', primary_key=True, serialize=False)),
                ('time', models.IntegerField(db_column='changeover_cost_time')),
                ('statusId', models.IntegerField(db_column='changeover_cost_active')),
                ('fromStatusId', models.ForeignKey(db_column='from_status', on_delete=django.db.models.deletion.DO_NOTHING, related_name='change_from_status', to='appRESTFul.productionstatus')),
                ('toStatusId', models.ForeignKey(db_column='to_status', on_delete=django.db.models.deletion.DO_NOTHING, related_name='change_to_status', to='appRESTFul.productionstatus')),
            ],
            options={
                'db_table': 'changeover_cost',
                'managed': True,
            },
        ),
    ]
