All schema changes that were applied via 'prisma db push' over the past
several months were never captured in migration files. When the postgres
pod restarted just before the migration job ran, the database was rebuilt
from the 15 existing migrations -- creating an old schema that was missing
~20 tables and significant structural changes to User, Opportunity,
CatalogItem, and Company.
This migration bridges the gap idempotently:
- New enums: PhoneType, FaxType, BillingMethod, BillingType, GenderType,
USState, Country, OpportunityInterest
- User: add firstName/lastName/title/active/hidden/cwMemberId/updatedBy;
drop emailVerified/name; make userId nullable
- CatalogItem: TEXT id → INTEGER id + TEXT uid PK; restructure FK columns
- Company: TEXT id → INTEGER id + TEXT uid PK; drop old CW columns; add
dateDeleted/deleteFlag/phone/taxExempt/taxId/website/enteredById
- Opportunity: TEXT id → INTEGER id + TEXT uid PK; drop ~25 flat CW
columns; add typeId/statusId/contactId/siteId/locationId/departmentId/
closedById/primarySalesRepId/secondarySalesRepId/eneteredBy/updatedBy/
oppNarrative/taxCodeId/interest; drop cwDateEntered
- UnifiSite: companyId TEXT → INTEGER
- 20+ new tables: CorporateLocation, InternalDepartment, CompanyAddress,
Contact, CatalogItemType, CatalogCategory, CatalogSubcategory,
CatalogManufacturer, Warehouse, WarehouseBin, ProductInventory,
MinimumStockByWarehouse, ProductData, ServiceTicket, ServiceTicketNote,
ServiceTicketType, ServiceTicketBoard, ServiceTicketLocation,
ServiceTicketSource, ServiceTicketImpact, ServiceTicketPriority,
ServiceTicketServerity, ServiceTicketFinalData, OpportunityType,
OpportunityStatus, ScheduleStatus, ScheduleType, ScheduleSpan,
Schedule, TaxCode
Verified: all 16 migrations apply cleanly on a fresh DB and produce zero
schema drift (prisma migrate diff outputs '-- This is an empty migration.')
Fixes P2022 ColumnNotFound errors on login and all model queries.
Fixed field name mismatches for tables with lastUpdatedUTC (all-caps):
- IV_Product: lastUpdateUtc → lastUpdatedUTC
- Department: lastUpdateUtc → lastUpdatedUTC
These field names must match the Prisma schema exactly (case-sensitive).
Ensures smart sync decision logic can correctly probe for record updates.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add unsaved changes guard (UnsavedChangesDialog, EditGuard, dirtyState store)
- Add Breadcrumb component
- Add EmailText component
- Update sales opportunity detail with new tabs and workflow
- Add dashboard tab to sales page with metrics
- Update opportunity API URLs to include /opportunity/ path segment
- Add auth token refresh endpoint
- Add credential-types API endpoint
- Add CW members store
- Add sales-utils helpers
- Update layout server to return user info alongside canViewAdmin
- Fix unit tests to match updated API paths and return shapes
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Creates the CwMember table migration that was missing from the migration history
(previously applied locally via db push but never migrated for production).
- Add taxableFlag boolean field to product update schema and forecast patch
- Fall back to QUO-Narrative product customerDescription for quote narrative
- Reconcile orphaned local opportunity records not found in CW during refresh
- Invalidate caches for removed orphaned opportunities
- Add reconciled event and orphanedCount to refresh events
- Update API_ROUTES.md with taxableFlag field documentation
SvelteKit rejects files with + prefix in routes/ during vite build.
Renamed all +*.spec.ts files to drop the + prefix (e.g. +page.server.spec.ts → page.server.spec.ts).
This fixes both Docker and Electron Forge builds.