Coverage for modules\logistics\migrations\0001_initial.py: 100%
7 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-09-06 16:58 +0800
« prev ^ index » next coverage.py v7.16.0, created at 2026-09-06 16:58 +0800
1# Generated by Django 5.1.15 on 2026-09-05 15:39
3import django.db.models.deletion
4import uuid
5from django.db import migrations, models
8class Migration(migrations.Migration):
10 initial = True
12 dependencies = [
13 ]
15 operations = [
16 migrations.CreateModel(
17 name='Booking',
18 fields=[
19 ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
20 ('tenant_id', models.UUIDField(db_index=True, help_text='Organization / Tenant ID')),
21 ('booking_number', models.CharField(max_length=50, unique=True)),
22 ('booking_type', models.CharField(choices=[('SHIPMENT', 'Shipment'), ('WAREHOUSE', 'Warehouse'), ('FREIGHT', 'Freight'), ('TRANSPORT', 'Transport')], max_length=20)),
23 ('client_name', models.CharField(max_length=255)),
24 ('client_email', models.EmailField(blank=True, max_length=254)),
25 ('client_phone', models.CharField(blank=True, max_length=50)),
26 ('origin', models.CharField(max_length=255)),
27 ('destination', models.CharField(max_length=255)),
28 ('booking_date', models.DateField()),
29 ('scheduled_date', models.DateField(blank=True, null=True)),
30 ('completed_date', models.DateField(blank=True, null=True)),
31 ('status', models.CharField(choices=[('PENDING', 'Pending'), ('CONFIRMED', 'Confirmed'), ('LOADED', 'Loaded'), ('IN_TRANSIT', 'In Transit'), ('DELIVERED', 'Delivered'), ('CANCELLED', 'Cancelled')], default='PENDING', max_length=20)),
32 ('cargo_description', models.TextField(blank=True)),
33 ('weight_kg', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
34 ('volume_cbm', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
35 ('number_of_packages', models.IntegerField(default=0)),
36 ('vessel_name', models.CharField(blank=True, max_length=255)),
37 ('voyage_number', models.CharField(blank=True, max_length=50)),
38 ('container_number', models.CharField(blank=True, max_length=50)),
39 ('seal_number', models.CharField(blank=True, max_length=50)),
40 ('total_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
41 ('notes', models.TextField(blank=True)),
42 ('created_at', models.DateTimeField(auto_now_add=True)),
43 ('updated_at', models.DateTimeField(auto_now=True)),
44 ],
45 options={
46 'ordering': ['-created_at'],
47 },
48 ),
49 migrations.CreateModel(
50 name='FreightQuote',
51 fields=[
52 ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
53 ('tenant_id', models.UUIDField(db_index=True, help_text='Organization / Tenant ID')),
54 ('quote_number', models.CharField(max_length=50, unique=True)),
55 ('client_name', models.CharField(max_length=255)),
56 ('client_email', models.EmailField(blank=True, max_length=254)),
57 ('carrier', models.CharField(blank=True, max_length=255)),
58 ('service_type', models.CharField(choices=[('IMPORT', 'Import'), ('EXPORT', 'Export'), ('TRANSIT', 'Transit'), ('DOOR_TO_DOOR', 'Door to Door'), ('PORT_TO_PORT', 'Port to Port')], max_length=20)),
59 ('origin_port', models.CharField(max_length=255)),
60 ('destination_port', models.CharField(max_length=255)),
61 ('vessel_name', models.CharField(blank=True, max_length=255)),
62 ('voyage_number', models.CharField(blank=True, max_length=50)),
63 ('etd', models.DateField(blank=True, null=True)),
64 ('eta', models.DateField(blank=True, null=True)),
65 ('container_type', models.CharField(blank=True, max_length=50)),
66 ('number_of_containers', models.IntegerField(default=0)),
67 ('cargo_description', models.TextField(blank=True)),
68 ('weight_kg', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
69 ('volume_cbm', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
70 ('currency', models.CharField(default='USD', max_length=3)),
71 ('ocean_freight', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
72 ('thc_origin', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
73 ('thc_destination', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
74 ('clearance_cost', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
75 ('delivery_cost', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
76 ('total_quote', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
77 ('valid_until', models.DateField(blank=True, null=True)),
78 ('status', models.CharField(choices=[('DRAFT', 'Draft'), ('QUOTED', 'Quoted'), ('NEGOTIATING', 'Negotiating'), ('CONFIRMED', 'Confirmed'), ('CANCELLED', 'Cancelled')], default='DRAFT', max_length=20)),
79 ('notes', models.TextField(blank=True)),
80 ('created_at', models.DateTimeField(auto_now_add=True)),
81 ('updated_at', models.DateTimeField(auto_now=True)),
82 ],
83 options={
84 'ordering': ['-created_at'],
85 },
86 ),
87 migrations.CreateModel(
88 name='ShippingQuote',
89 fields=[
90 ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
91 ('tenant_id', models.UUIDField(db_index=True, help_text='Organization / Tenant ID')),
92 ('quote_number', models.CharField(max_length=50, unique=True)),
93 ('client_name', models.CharField(max_length=255)),
94 ('client_email', models.EmailField(blank=True, max_length=254)),
95 ('client_phone', models.CharField(blank=True, max_length=50)),
96 ('shipment_type', models.CharField(choices=[('FCL', 'Full Container Load'), ('LCL', 'Less than Container Load'), ('AIR', 'Air Freight'), ('ROAD', 'Road Freight'), ('RAIL', 'Rail Freight')], max_length=20)),
97 ('origin', models.CharField(max_length=255)),
98 ('destination', models.CharField(max_length=255)),
99 ('cargo_description', models.TextField(blank=True)),
100 ('weight_kg', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
101 ('volume_cbm', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
102 ('number_of_packages', models.IntegerField(default=0)),
103 ('estimated_departure', models.DateField(blank=True, null=True)),
104 ('estimated_arrival', models.DateField(blank=True, null=True)),
105 ('currency', models.CharField(default='USD', max_length=3)),
106 ('freight_cost', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
107 ('insurance_cost', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
108 ('other_charges', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
109 ('total_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
110 ('valid_until', models.DateField(blank=True, null=True)),
111 ('status', models.CharField(choices=[('DRAFT', 'Draft'), ('SENT', 'Sent'), ('ACCEPTED', 'Accepted'), ('REJECTED', 'Rejected'), ('EXPIRED', 'Expired')], default='DRAFT', max_length=20)),
112 ('notes', models.TextField(blank=True)),
113 ('created_at', models.DateTimeField(auto_now_add=True)),
114 ('updated_at', models.DateTimeField(auto_now=True)),
115 ],
116 options={
117 'ordering': ['-created_at'],
118 },
119 ),
120 migrations.CreateModel(
121 name='TransportationRate',
122 fields=[
123 ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
124 ('tenant_id', models.UUIDField(db_index=True, help_text='Organization / Tenant ID')),
125 ('rate_name', models.CharField(max_length=255)),
126 ('rate_type', models.CharField(choices=[('PER_KG', 'Per Kilogram'), ('PER_CBM', 'Per Cubic Meter'), ('FLAT_RATE', 'Flat Rate'), ('CONTAINER_RATE', 'Container Rate')], max_length=20)),
127 ('mode', models.CharField(choices=[('SEA', 'Sea'), ('AIR', 'Air'), ('ROAD', 'Road'), ('RAIL', 'Rail'), ('MULTIMODAL', 'Multimodal')], max_length=20)),
128 ('origin', models.CharField(max_length=255)),
129 ('destination', models.CharField(max_length=255)),
130 ('carrier', models.CharField(blank=True, max_length=255)),
131 ('transit_days', models.IntegerField(default=0)),
132 ('currency', models.CharField(default='USD', max_length=3)),
133 ('rate_value', models.DecimalField(decimal_places=2, max_digits=10)),
134 ('minimum_charge', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
135 ('fuel_surcharge', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
136 ('effective_from', models.DateField()),
137 ('effective_to', models.DateField(blank=True, null=True)),
138 ('is_active', models.BooleanField(default=True)),
139 ('notes', models.TextField(blank=True)),
140 ('created_at', models.DateTimeField(auto_now_add=True)),
141 ('updated_at', models.DateTimeField(auto_now=True)),
142 ],
143 options={
144 'ordering': ['-created_at'],
145 },
146 ),
147 migrations.CreateModel(
148 name='Warehouse',
149 fields=[
150 ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
151 ('tenant_id', models.UUIDField(db_index=True, help_text='Organization / Tenant ID')),
152 ('name', models.CharField(max_length=255)),
153 ('warehouse_type', models.CharField(choices=[('STORAGE', 'Storage'), ('DISTRIBUTION', 'Distribution'), ('FULFILLMENT', 'Fulfillment'), ('COLD_STORAGE', 'Cold Storage'), ('BONDED', 'Bonded')], default='STORAGE', max_length=50)),
154 ('address', models.TextField(blank=True)),
155 ('city', models.CharField(blank=True, max_length=100)),
156 ('country', models.CharField(blank=True, max_length=100)),
157 ('contact_name', models.CharField(blank=True, max_length=255)),
158 ('contact_phone', models.CharField(blank=True, max_length=50)),
159 ('contact_email', models.EmailField(blank=True, max_length=254)),
160 ('capacity_cubic_meters', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
161 ('capacity_tons', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
162 ('is_active', models.BooleanField(default=True)),
163 ('notes', models.TextField(blank=True)),
164 ('created_at', models.DateTimeField(auto_now_add=True)),
165 ('updated_at', models.DateTimeField(auto_now=True)),
166 ],
167 options={
168 'ordering': ['-created_at'],
169 },
170 ),
171 migrations.CreateModel(
172 name='TrackingEvent',
173 fields=[
174 ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
175 ('updated_at', models.DateTimeField(auto_now=True)),
176 ('tenant_id', models.UUIDField(db_index=True, help_text='Organization / Tenant ID')),
177 ('shipment_reference', models.CharField(db_index=True, max_length=100)),
178 ('event_type', models.CharField(choices=[('PICKUP', 'Pickup'), ('IN_TRANSIT', 'In Transit'), ('ARRIVED', 'Arrived'), ('CUSTOMS', 'Customs'), ('OUT_FOR_DELIVERY', 'Out for Delivery'), ('DELIVERED', 'Delivered'), ('EXCEPTION', 'Exception'), ('RETURNED', 'Returned')], max_length=20)),
179 ('location', models.CharField(max_length=255)),
180 ('event_date', models.DateTimeField()),
181 ('description', models.TextField(blank=True)),
182 ('created_at', models.DateTimeField(auto_now_add=True)),
183 ('booking', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tracking_events', to='logistics.booking')),
184 ],
185 options={
186 'ordering': ['-event_date'],
187 },
188 ),
189 migrations.CreateModel(
190 name='WarehouseReceipt',
191 fields=[
192 ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
193 ('tenant_id', models.UUIDField(db_index=True, help_text='Organization / Tenant ID')),
194 ('receipt_number', models.CharField(max_length=50, unique=True)),
195 ('client_name', models.CharField(max_length=255)),
196 ('client_reference', models.CharField(blank=True, max_length=100)),
197 ('receipt_date', models.DateField()),
198 ('arrival_date', models.DateField(blank=True, null=True)),
199 ('release_date', models.DateField(blank=True, null=True)),
200 ('status', models.CharField(choices=[('PENDING', 'Pending'), ('RECEIVED', 'Received'), ('IN_STORAGE', 'In Storage'), ('RELEASED', 'Released'), ('CANCELLED', 'Cancelled')], default='PENDING', max_length=20)),
201 ('goods_description', models.TextField(blank=True)),
202 ('number_of_packages', models.IntegerField(default=0)),
203 ('gross_weight_kg', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
204 ('volume_cubic_meters', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
205 ('storage_days', models.IntegerField(default=0)),
206 ('handling_fee', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
207 ('storage_fee', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
208 ('total_fee', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
209 ('notes', models.TextField(blank=True)),
210 ('created_at', models.DateTimeField(auto_now_add=True)),
211 ('updated_at', models.DateTimeField(auto_now=True)),
212 ('warehouse', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='receipts', to='logistics.warehouse')),
213 ],
214 options={
215 'ordering': ['-created_at'],
216 },
217 ),
218 ]