--- id: fix-parts-timestamps-spec name: Fix Parts Table Timestamp NOT NULL and onUpdate Spec status: completed depends_on: [] scope: narrow risk: low impact: isolated level: implementation --- ## Description W22: The `parts` table defines its own `id`, `metadata`, `createdAt`, `updatedAt` instead of using `commonCols`, but the spec only says "defaults to `now()`" without specifying NOT NULL or `$onUpdate`. If the Drizzle implementation omits `$onUpdate`, parts rows never have `updatedAt` updated on modification. If timestamps are not NOT NULL, they can become NULL. The `parts` table spec must explicitly state that `createdAt` and `updatedAt` are NOT NULL and that `updatedAt` includes `$onUpdate(() => new Date())`. Either replicate these details from `commonCols` with an explicit override note for `id`, or reference `commonCols` with the `id` exception documented. ## Acceptance Criteria - [ ] `sessions.md` parts table: `createdAt` and `updatedAt` specified as `NOT NULL` - [ ] `updatedAt` specified with `$onUpdate(() => new Date())` - [ ] Note added explaining why `parts` uses custom columns instead of `commonCols` (sortable ID vs UUIDv4) - [ ] `id` column exception documented (sortable ID, not UUIDv4 from commonCols) ## References - docs/reviews/storage-architecture-review-2026-04-21.md#W22 - docs/architecture/storage/sessions.md:99-107 - docs/architecture/storage/README.md:69-82 ## Notes > To be filled by implementation agent ## Summary > To be filled on completion