wip(freight): migration 0017 + model/column-list groundwork for add-freight-templates

This commit is contained in:
Chengdong Zhang
2026-09-23 17:39:45 +08:00
parent a83e857bdf
commit 5b426486ac
105 changed files with 6193 additions and 1566 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ P2 freight ───────────┘(改 checkout/order totals,
|---|---|---|---|---|
| P0 | `add-aftersale-refunds` | — | archived | 2026-09-23 |
| P1 | `add-product-reviews` | — | proposed | — |
| P2 | `add-freight-templates` | —(与 P0 串行) | proposed | — |
| P2 | `add-freight-templates` | —(与 P0 串行) | implementing | — |
| P3 | `add-wallet-settlement` | P0 | proposed | — |
| P4 | `add-mobile-h5` | P0、P3(软) | proposed | — |
| P5 | `add-merchant-onboarding` | — | proposed | — |
@@ -1,3 +1,5 @@
> **Progress 2026-09-23:** migration `0017_freight_templates.sql` written (incl. `skus.weight_grams` for by-weight and `shipments.shipping_company_code`); models extended (`Order.shipping_fee_minor`, `OrderItem` freight snapshots, `Sku.weight_grams`, `FreightPricingMethod`); order/sku SQL column lists updated; `cargo test -p vmall-api` green. Not started: shared contract (1.2), freight module (1.3), calculation + checkout wiring (2.x), frontends (3.x/4.x), verification (5.x).
## 1. Migration and shared contract
- [ ] 1.1 Add migration `0017_freight_templates.sql`: `freight_templates` (shop FK, name, default flag with a partial unique index per shop, always-free toggle, `by_piece`/`by_weight` pricing method, first/additional unit fees as i64 minor units, integer first/additional unit sizes in pieces or grams, optional free-shipping threshold in i64 minor units), `freight_region_rules` (template FK, region code set, overriding fees and unit sizes), `shipping_companies` (code, `{en, zh}` JSONB name), `orders.shipping_fee_minor`, `order_items` pricing-method and template-id snapshot columns, and `shipments.shipping_company_code`, with shop/template indexes and cascading deletes.