FORGE-85: shared enum value arrays in @forgegraph/db/enums #696

Merged
gmackie merged 1 commit from FORGE-85-enum-arrays into main 2026-10-12 04:50:42 +00:00
Owner

Part 1 of FORGE-85 (D1 Phase 2, parent FORGE-69). No behaviour change.

  • packages/db/src/enums.ts: as const value arrays for all 78 pgEnums, exported as @forgegraph/db/enums.
  • Every schema file builds its pgEnum from the shared array.
  • 103 server-side sites in packages/api and apps/web that repeated a full enum list in z.enum([...]) or [...] as const now import the array. Subsets (queued/running), coincidental matches (app-release semver bump vs registry_upgrade_type), tests, mobile and client UI are left alone.

Verification

  • drizzle-kit export SQL is byte-identical before and after (78 CREATE TYPE, no diff).
  • New packages/db/src/enums.test.ts asserts each pgEnum is built from its array (79 tests).
  • tsc clean for packages/db, packages/api, apps/web; oxlint reports no new errors.

🤖 Generated with Claude Code

Part 1 of FORGE-85 (D1 Phase 2, parent FORGE-69). No behaviour change. - `packages/db/src/enums.ts`: `as const` value arrays for all 78 pgEnums, exported as `@forgegraph/db/enums`. - Every schema file builds its pgEnum from the shared array. - 103 server-side sites in packages/api and apps/web that repeated a full enum list in `z.enum([...])` or `[...] as const` now import the array. Subsets (queued/running), coincidental matches (app-release semver bump vs registry_upgrade_type), tests, mobile and client UI are left alone. Verification - `drizzle-kit export` SQL is byte-identical before and after (78 CREATE TYPE, no diff). - New `packages/db/src/enums.test.ts` asserts each pgEnum is built from its array (79 tests). - tsc clean for packages/db, packages/api, apps/web; oxlint reports no new errors. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
FORGE-85: shared enum value arrays in @forgegraph/db/enums
All checks were successful
CI / gitleaks (pull_request) Successful in 7s
CI / storybook (pull_request) Successful in 1m47s
CI / unit-api (pull_request) Successful in 2m45s
CI / web-build (pull_request) Successful in 4m8s
CI / checks (pull_request) Successful in 4m15s
CI / unit-web (pull_request) Successful in 3m44s
CI / go (pull_request) Successful in 1m18s
CI / database (pull_request) Successful in 3m5s
forgegraph/ci CI passed
CI / ci (pull_request) Successful in 52s
fe9e7f4009
Move the value lists of all 78 pgEnums into packages/db/src/enums.ts as
`as const` arrays. Each schema file now builds its pgEnum from the shared
array, so the D1 schema (FORGE-69) can build CHECK-constrained text columns
from the same source.

Server code that repeated a full enum list in z.enum([...]) or
[...] as const now imports the array (103 sites in packages/api and
apps/web). Subsets (queued/running), coincidental matches (semver bump
vs registry_upgrade_type), tests, mobile and client UI are unchanged.

drizzle-kit export output is byte-identical before and after. A db test
asserts every pgEnum is built from its shared array.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign in to join this conversation.
No description provided.