# Generated by Django 5.2.7 on 2026-02-05 08:46 import django.db.models.deletion from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Category', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=100)), ], options={ 'verbose_name_plural': 'Categories', }, ), migrations.CreateModel( name='Plant', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255)), ('location', models.CharField(blank=True, max_length=255)), ], ), migrations.CreateModel( name='Machine', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255)), ('status', models.CharField(choices=[('active', 'Active'), ('maintenance', 'Maintenance'), ('broken', 'Broken')], default='active', max_length=20)), ('last_maintenance', models.DateField(blank=True, null=True)), ('plant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='machines', to='core.plant')), ], ), migrations.CreateModel( name='Product', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255)), ('sku', models.CharField(max_length=100, unique=True)), ('description', models.TextField(blank=True)), ('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.category')), ], ), migrations.CreateModel( name='WorkOrder', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('order_number', models.CharField(max_length=50, unique=True)), ('quantity', models.PositiveIntegerField()), ('status', models.CharField(choices=[('planned', 'Planned'), ('in_progress', 'In Progress'), ('completed', 'Completed'), ('cancelled', 'Cancelled')], default='planned', max_length=20)), ('start_date', models.DateTimeField(blank=True, null=True)), ('end_date', models.DateTimeField(blank=True, null=True)), ('machine', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.machine')), ('plant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.plant')), ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.product')), ], ), migrations.CreateModel( name='Inspection', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('result', models.CharField(choices=[('pass', 'Pass'), ('fail', 'Fail')], max_length=10)), ('notes', models.TextField(blank=True)), ('timestamp', models.DateTimeField(auto_now_add=True)), ('inspector', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), ('work_order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='inspections', to='core.workorder')), ], ), migrations.CreateModel( name='Inventory', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('quantity', models.DecimalField(decimal_places=2, default=0, max_digits=12)), ('lot_number', models.CharField(blank=True, max_length=100)), ('plant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='inventory', to='core.plant')), ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.product')), ], options={ 'verbose_name_plural': 'Inventory', 'unique_together': {('plant', 'product', 'lot_number')}, }, ), ]