Coverage for add_shipment.py: 0%
8 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-17 16:50 +0800
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-17 16:50 +0800
1import sqlite3
2c = sqlite3.connect('db.sqlite3')
3cur = c.cursor()
5# Create erp_shipment table
6cur.execute("""
7CREATE TABLE IF NOT EXISTS erp_shipment (
8 id VARCHAR(36) PRIMARY KEY,
9 tenant_id VARCHAR(36) NOT NULL,
10 created_at DATETIME NOT NULL,
11 updated_at DATETIME NOT NULL,
12 reference_number VARCHAR(32) NOT NULL,
13 customer_name VARCHAR(255) NOT NULL,
14 customer_email VARCHAR(255),
15 shipment_type VARCHAR(16) NOT NULL DEFAULT 'IMPORT',
16 status VARCHAR(32) NOT NULL DEFAULT 'DRAFT',
17 origin VARCHAR(255) NOT NULL,
18 destination VARCHAR(255) NOT NULL,
19 carrier VARCHAR(255),
20 tracking_number VARCHAR(128),
21 bill_of_lading VARCHAR(128),
22 customs_entry_number VARCHAR(128),
23 estimated_arrival DATE,
24 declared_value DECIMAL(18,2) NOT NULL DEFAULT 0.00,
25 duty_amount DECIMAL(18,2) NOT NULL DEFAULT 0.00,
26 freight_amount DECIMAL(18,2) NOT NULL DEFAULT 0.00,
27 currency VARCHAR(3) NOT NULL DEFAULT 'PHP',
28 notes TEXT,
29 UNIQUE (tenant_id, reference_number)
30)
31""")
32c.commit()
33print("erp_shipment table created")
35# Verify
36cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE 'erp_%'")
37print("ERP tables now:", [r[0] for r in cur.fetchall()])