chore(i18n): drop legacy free-text country/nationality columns
Test-data only — no production migration needed (per earlier decision).
Schema is now ISO-only; readers convert ISO codes to localized names where
human-readable output is required (EOI documents, invoices, portal).
Migration 0016 drops:
- clients.nationality
- companies.incorporation_country
- client_addresses.{state_province, country}
- company_addresses.{state_province, country}
Code paths that previously read free-text values now read the ISO column
and pass through `getCountryName()` / `getSubdivisionName()` for rendering.
Document templates ({{client.nationality}}), portal client view, EOI/
reservation-agreement contexts, and invoice billing addresses all updated.
Public yacht-interest endpoint (/api/public/interests) drops the legacy
fields from its insert path and writes ISO codes only. The Zod validators
no longer accept the legacy fields — older website builds posting raw
'incorporationCountry' / 'country' / 'stateProvince' will get 400s.
Server-side phone normalization is unchanged.
Seed data updated to use ISO codes (GB/FR/ES/GR/SE/IT/GH/MC/PA), spread
across continents to keep test fixtures realistic.
Test assertions updated to match the new render shape (e.g.
'United States' not 'US', 'California' not 'CA').
Vitest: 741 -> 741 (unchanged count; assertions updated, no new tests).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
6
src/lib/db/migrations/0016_magical_spyke.sql
Normal file
6
src/lib/db/migrations/0016_magical_spyke.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
ALTER TABLE "client_addresses" DROP COLUMN "state_province";--> statement-breakpoint
|
||||
ALTER TABLE "client_addresses" DROP COLUMN "country";--> statement-breakpoint
|
||||
ALTER TABLE "clients" DROP COLUMN "nationality";--> statement-breakpoint
|
||||
ALTER TABLE "companies" DROP COLUMN "incorporation_country";--> statement-breakpoint
|
||||
ALTER TABLE "company_addresses" DROP COLUMN "state_province";--> statement-breakpoint
|
||||
ALTER TABLE "company_addresses" DROP COLUMN "country";
|
||||
9849
src/lib/db/migrations/meta/0016_snapshot.json
Normal file
9849
src/lib/db/migrations/meta/0016_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -113,6 +113,13 @@
|
||||
"when": 1777391373291,
|
||||
"tag": "0015_i18n_columns",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 16,
|
||||
"version": "7",
|
||||
"when": 1777395538988,
|
||||
"tag": "0016_magical_spyke",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user