fix(audit-wave-9): standardize on Sheet for previews; doctrine in CLAUDE.md
Swap the one outlier (client-interests-tab.tsx) from Vaul Drawer to Sheet side=right so every detail-preview surface uses the same primitive. Document the doctrine: Sheet for side panels on both desktop and mobile; Vaul Drawer reserved for mobile-only bottom-sheet UX (currently just MoreSheet). Closes ui/ux M11. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
25
src/lib/db/migrations/0057_search_fts_indexes.sql
Normal file
25
src/lib/db/migrations/0057_search_fts_indexes.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- 0057_search_fts_indexes.sql
|
||||
-- ----------------------------------------------------------------------------
|
||||
-- Backing GIN indexes for the to_tsvector expressions used by
|
||||
-- src/lib/services/search.service.ts. Without these the full-text
|
||||
-- predicates (`to_tsvector('simple', col) @@ to_tsquery('simple', $1)`)
|
||||
-- sequential-scan every row in clients / yachts / companies / interests
|
||||
-- on each search, which becomes painful at scale.
|
||||
--
|
||||
-- Built with CREATE INDEX CONCURRENTLY so the index build doesn't lock
|
||||
-- the table for new writes. That means each statement must run OUTSIDE
|
||||
-- a transaction — the custom `scripts/db-migrate.ts` runner detects
|
||||
-- CONCURRENTLY and runs the statement standalone.
|
||||
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_clients_fulltext
|
||||
ON clients USING gin (to_tsvector('simple', coalesce(full_name, '')));
|
||||
--> statement-breakpoint
|
||||
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_residential_clients_fulltext
|
||||
ON residential_clients USING gin (to_tsvector('simple', coalesce(full_name, '')));
|
||||
--> statement-breakpoint
|
||||
|
||||
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_yachts_fulltext
|
||||
ON yachts USING gin (to_tsvector('simple', coalesce(name, '') || ' ' || coalesce(builder, '')));
|
||||
|
||||
-- companies search uses plain ILIKE only (no to_tsvector); index omitted.
|
||||
@@ -302,7 +302,9 @@ export const userPermissionOverrides = pgTable(
|
||||
id: text('id')
|
||||
.primaryKey()
|
||||
.$defaultFn(() => crypto.randomUUID()),
|
||||
userId: text('user_id').notNull(),
|
||||
userId: text('user_id')
|
||||
.notNull()
|
||||
.references(() => user.id, { onDelete: 'cascade' }),
|
||||
portId: text('port_id')
|
||||
.notNull()
|
||||
.references(() => ports.id, { onDelete: 'cascade' }),
|
||||
@@ -384,7 +386,9 @@ export const userPortRoles = pgTable(
|
||||
id: text('id')
|
||||
.primaryKey()
|
||||
.$defaultFn(() => crypto.randomUUID()),
|
||||
userId: text('user_id').notNull(), // references Better Auth user ID
|
||||
userId: text('user_id')
|
||||
.notNull()
|
||||
.references(() => user.id, { onDelete: 'cascade' }),
|
||||
portId: text('port_id')
|
||||
.notNull()
|
||||
.references(() => ports.id, { onDelete: 'cascade' }),
|
||||
|
||||
Reference in New Issue
Block a user