f56c49e242a7199811169a1c4a18f44a0f3fe71e
Two bugs in the catch-up migration that only manifest with real production data: 1. Company (4520 rows): uid was added as TEXT NOT NULL DEFAULT '' causing all existing rows to get uid='' which makes the PRIMARY KEY constraint fail with 'could not create unique index, Key (uid)=() is duplicated'. Fix: add uid as nullable, UPDATE uid = id (copies the existing CUID text PK into uid), then SET NOT NULL, then swap PK. Also populate the new integer id column from cw_CompanyId (which is fully populated in prod). 2. UnifiSite (180 rows): old approach just dropped the text companyId and added a null integer column, destroying all company relationships. Fix: add companyId_int, UPDATE via JOIN on Company.uid (= old Company.id text), drop old text column, rename integer column. Also fix the P3009 handler in migrate-entrypoint.sh: Prisma may emit ANSI color codes even without a TTY, wrapping backticks in escape sequences and breaking the regex match. Fix: strip ANSI codes with sed before extracting the migration name. Also simplify the regex from a rigid format match to a simpler backtick-content grep. Production DB manually unblocked (migrate resolve --rolled-back) so the next deploy will cleanly apply the corrected migration.
optima
The primary repository for Optima.
Languages
TypeScript
64.3%
Svelte
23.1%
CSS
5.6%
TSQL
5.4%
Python
1%
Other
0.5%