Review: Drizzle setup + drizzle-kit pull schema.ts from basketball db
Verdict: NEEDS_REFINEMENT
Board item #1089 — Forgejo issue forgejo_admin/westside-admin#1. Type=Feature. Backlog -> review gate.
Template Completeness
- [x] Type — Feature
- [x] Lineage — "Depends on scaffolding ticket" (vague, see Recommendation)
- [x] Repo — forgejo_admin/westside-admin
- [x] User Story — story-westside-admin-admin-row-crud
- [x] Context
- [x] File Targets (Create section)
- [x] Acceptance Criteria
- [x] Test Expectations
- [x] Constraints
- [x] Checklist
- [x] Related
Traceability
- [x] story:admin-row-crud label — story-westside-admin-admin-row-crud
- [x] story entry verified — present in project-westside-admin user-stories table (single v1 story)
- [x] arch:scopeddb-helper label — present
- [ ] arch note MISSING — search_notes finds no note matching arch-scopeddb-helper. Project page architecture section lists arch-domain-westside-admin, arch-dataflow-westside-admin, arch-deployment-westside-admin — none correspond to the scopeddb-helper label. The "scoped DB helper" is described in Safety Constraint #2 (tenant scoping) but has no dedicated arch note. [SCOPE] Create arch-scopeddb-helper note OR re-label this ticket to an existing arch (e.g. arch-domain-westside-admin which covers the schema/introspection topic).
- [x] Forgejo issue — https://forgejo.tail5b443a.ts.net/forgejo_admin/westside-admin/issues/1, open
File Targets
Repo is greenfield — only README.md exists on main. All targets are net-new creates, so file-existence verification is N/A. Targets are well-specified:
- [x] drizzle.config.ts — config spec clear
- [x] src/lib/server/db.ts — pattern + non-export discipline stated
- [x] src/lib/server/schema.ts — generated, committed
- [x] package.json — deps + db:pull script
Note: src/lib/server/ doesn't exist yet — it will be produced by scaffolding ticket #6. This is fine; just confirms the hard dependency on #6 landing first.
Repo Placement
OK. Forgejo issue is on forgejo_admin/westside-admin. No cross-repo file targets in this ticket.
Dependencies
- Hard blocker: westside-admin#6 (Scaffold SvelteKit adapter-node + TypeScript + ESLint) — must merge before this ticket starts (no src/ tree exists yet). Issue body says "Depends on scaffolding ticket" but does not link the issue number. [BODY] Replace "Depends on scaffolding ticket" with explicit "Blocked by #6".
- Hard blocker for AC verification: pal-e-platform#302 (admin_app Postgres user) — needed for the integration AC ("db.select().from(schema.tenants)") and CI drift check. Currently in backlog. [BODY] Add explicit reference to pal-e-platform#302 under Lineage so dispatch order is unambiguous.
- Downstream consumers (not blocking this ticket but worth noting): westside-admin#2 (hooks-server), #4/#5 (page-server), #3 (scopeddb helper) all import from src/lib/server/schema.ts and src/lib/server/db.ts.
Acceptance Criteria
Verifiable and testable. Strong points: explicit table count (22), enum count (18), CI drift check, lazy-init pool, SIGTERM handling. One concern:
- AC "CI step added: re-run db:pull against live DB, fail on diff" requires Woodpecker CI to be wired AND DATABASE_URL secret available in CI. Woodpecker CI for this repo is scoped under issue #8 (woodpecker-ci) which is also backlog. The CI drift check may need to be deferred or the dependency made explicit. [BODY] Either narrow this AC to "drift check script exists and runs locally" or note explicit dependency on #8.
Blast Radius
Greenfield repo — no existing patterns to break. Pattern choice (pg driver, drizzle-orm, env-driven config) matches westside-app's connection pool convention per Constraints. jsonb narrowing decision is flagged in Constraints with a defer-or-document option, which is acceptable.
Decomposition Assessment
4 file targets, 6 acceptance criteria, single repo, tight scope (drizzle install + pull + commit + CI). Estimated agent work ~5–10 min. Borderline but acceptable as one ticket. No decomposition needed.
Recommendation
[BODY]Replace "Depends on scaffolding ticket" with "Blocked by westside-admin#6 (scaffolding) and pal-e-platform#302 (admin_app DB user)".[BODY]Either narrow the CI drift AC to "script exists, runnable locally" OR add explicit dependency on westside-admin#8 (woodpecker-ci wiring).[SCOPE]Resolve arch label mismatch: either create arch-scopeddb-helper note (if a dedicated component note is intended) or re-label this ticket with an existing arch slug (arch-domain-westside-admin is the closest fit since this ticket produces the schema artifact). Same arch:scopeddb-helper label is also used on board item #1091/issue #3, so the decision should be made jointly.
Once these are addressed, this ticket is ready to advance backlog -> todo. No decomposition required.