ixg_platform/apps/documents/migrations/0001_initial.py

72 lines
3.9 KiB
Python

# Generated by Django 5.2.12 on 2026-07-29 12:02
import django.db.models.deletion
import uuid
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('batches', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='CertificateOfAnalysis',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('file_url', models.TextField()),
('file_name', models.CharField(max_length=255)),
('issuer', models.CharField(blank=True, max_length=255)),
('issue_date', models.DateField(blank=True, null=True)),
('expiry_date', models.DateField(blank=True, null=True)),
('uploaded_at', models.DateTimeField(auto_now_add=True)),
('batch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='certificates_of_analysis', to='batches.processingbatch')),
('uploaded_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name_plural': 'Certificates of Analysis',
'db_table': 'certificates_of_analysis',
},
),
migrations.CreateModel(
name='Document',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('doc_type', models.CharField(choices=[('coa', 'Certificate of Analysis'), ('regulatory', 'Regulatory'), ('invoice', 'Invoice'), ('packing_list', 'Packing List'), ('bl', 'Bill of Lading'), ('insurance', 'Insurance'), ('other', 'Other')], max_length=20)),
('file_url', models.TextField()),
('file_name', models.CharField(max_length=255)),
('file_size_bytes', models.IntegerField(blank=True, null=True)),
('visibility', models.CharField(choices=[('buyer', 'Buyer'), ('ops', 'Operations'), ('admin', 'Admin')], default='buyer', max_length=10)),
('uploaded_at', models.DateTimeField(auto_now_add=True)),
('batch', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='documents', to='batches.processingbatch')),
('uploaded_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'documents',
},
),
migrations.CreateModel(
name='RegulatoryCert',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('cert_type', models.CharField(choices=[('phytosanitary', 'Phytosanitary'), ('export_permit', 'Export Permit'), ('organic', 'Organic'), ('fair_trade', 'Fair Trade'), ('eudr_dds', 'EUDR DDS'), ('other', 'Other')], max_length=20)),
('file_url', models.TextField()),
('file_name', models.CharField(max_length=255)),
('cert_reference', models.CharField(blank=True, max_length=255)),
('issue_date', models.DateField(blank=True, null=True)),
('expiry_date', models.DateField(blank=True, null=True)),
('uploaded_at', models.DateTimeField(auto_now_add=True)),
('batch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='regulatory_certs', to='batches.processingbatch')),
],
options={
'verbose_name': 'Regulatory Certificate',
'db_table': 'regulatory_certs',
},
),
]