refactor(clients): drop deprecated yacht/company/proxy columns
PR 13: now that all reads are migrated to the dedicated yacht / company
/ membership entities, drop the columns that mirrored them on `clients`:
companyName, isProxy, proxyType, actualOwnerName, relationshipNotes,
yachtName, yachtLength{Ft,M}, yachtWidth{Ft,M}, yachtDraft{Ft,M},
berthSizeDesired.
Migration `0008_loud_ikaris.sql` issues the destructive ALTER TABLE
DROP COLUMN statements. Run `pnpm db:push` (or the migration runner) to
apply.
Caller cleanup (zero behavioral change to remaining flows):
- Drops the legacy `generateEoi` flow entirely (route, service function,
pdfme template, validator schema). The dual-path generate-and-sign
service from PR 11 has fully replaced it; the route was no longer
wired to the UI.
- `clients.service`: company-name search column / WHERE / audit value
removed; search now ranks by full name only.
- `interests.service`: `resolveLeadCategory` reads dimensions from
`yachts` via `interest.yachtId` instead of the dropped
`client.yachtLength{Ft,M}`.
- `record-export`: client-summary now lists yachts via owner-side
lookup (direct + active company memberships); interest-summary fetches
yacht via `interest.yachtId`. Both PDF templates updated to read
yacht details from the new entity.
- `client-detail-header`, `client-picker`, `command-search`,
`search-result-item`, `use-search` hook, `types/domain.ts`,
`search.service` — drop the companyName badge / sub-label / typed
field everywhere it was rendered or fetched.
- `ai.ts` worker: drop the company / yacht context lines from the
prompt (will be re-added later sourced from the new entities).
- `validators/interests.ts`: remove the deprecated public-form flat
yacht/company fields. The route already ignores them.
- `factories.ts`: drop the `isProxy: false` default.
Tests: 652/652 green; type-check clean. The
`security-sensitive-data` tests use `companyName` / `isProxy` as
arbitrary record keys for a generic util — left unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
13
src/lib/db/migrations/0008_loud_ikaris.sql
Normal file
13
src/lib/db/migrations/0008_loud_ikaris.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
ALTER TABLE "clients" DROP COLUMN "company_name";--> statement-breakpoint
|
||||
ALTER TABLE "clients" DROP COLUMN "is_proxy";--> statement-breakpoint
|
||||
ALTER TABLE "clients" DROP COLUMN "proxy_type";--> statement-breakpoint
|
||||
ALTER TABLE "clients" DROP COLUMN "actual_owner_name";--> statement-breakpoint
|
||||
ALTER TABLE "clients" DROP COLUMN "relationship_notes";--> statement-breakpoint
|
||||
ALTER TABLE "clients" DROP COLUMN "yacht_name";--> statement-breakpoint
|
||||
ALTER TABLE "clients" DROP COLUMN "yacht_length_ft";--> statement-breakpoint
|
||||
ALTER TABLE "clients" DROP COLUMN "yacht_width_ft";--> statement-breakpoint
|
||||
ALTER TABLE "clients" DROP COLUMN "yacht_draft_ft";--> statement-breakpoint
|
||||
ALTER TABLE "clients" DROP COLUMN "yacht_length_m";--> statement-breakpoint
|
||||
ALTER TABLE "clients" DROP COLUMN "yacht_width_m";--> statement-breakpoint
|
||||
ALTER TABLE "clients" DROP COLUMN "yacht_draft_m";--> statement-breakpoint
|
||||
ALTER TABLE "clients" DROP COLUMN "berth_size_desired";
|
||||
8530
src/lib/db/migrations/meta/0008_snapshot.json
Normal file
8530
src/lib/db/migrations/meta/0008_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -57,6 +57,13 @@
|
||||
"when": 1776959993173,
|
||||
"tag": "0007_brainy_felicia_hardy",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 8,
|
||||
"version": "7",
|
||||
"when": 1777204563579,
|
||||
"tag": "0008_loud_ikaris",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
text,
|
||||
boolean,
|
||||
timestamp,
|
||||
numeric,
|
||||
jsonb,
|
||||
index,
|
||||
uniqueIndex,
|
||||
@@ -22,20 +21,7 @@ export const clients = pgTable(
|
||||
.notNull()
|
||||
.references(() => ports.id),
|
||||
fullName: text('full_name').notNull(),
|
||||
companyName: text('company_name'),
|
||||
nationality: text('nationality'),
|
||||
isProxy: boolean('is_proxy').notNull().default(false),
|
||||
proxyType: text('proxy_type'), // broker, representative, family_member, legal_counsel, other
|
||||
actualOwnerName: text('actual_owner_name'),
|
||||
relationshipNotes: text('relationship_notes'),
|
||||
yachtName: text('yacht_name'),
|
||||
yachtLengthFt: numeric('yacht_length_ft'),
|
||||
yachtWidthFt: numeric('yacht_width_ft'),
|
||||
yachtDraftFt: numeric('yacht_draft_ft'),
|
||||
yachtLengthM: numeric('yacht_length_m'),
|
||||
yachtWidthM: numeric('yacht_width_m'),
|
||||
yachtDraftM: numeric('yacht_draft_m'),
|
||||
berthSizeDesired: text('berth_size_desired'),
|
||||
preferredContactMethod: text('preferred_contact_method'), // email, phone, whatsapp
|
||||
preferredLanguage: text('preferred_language'),
|
||||
timezone: text('timezone'),
|
||||
|
||||
Reference in New Issue
Block a user