feat(db): @mosaic/db — Drizzle schema, PG connection, migrations #67

Merged
jason.woltje merged 1 commits from feat/p0-003-db-package into main 2026-03-13 02:17:19 +00:00
Owner

Summary

  • Implements P0-003: shared database package with Drizzle ORM
  • 13 tables: auth (BetterAuth-compatible), brain entities, chat
  • createDb() factory with pool cleanup, runMigrations() with try/finally
  • Full FK relationships and indexes on query-hot columns
  • drizzle-kit generate/push/migrate/studio scripts

Verification

  • Schema pushed to PG 17, all 13 tables created
  • CRUD round-trip tested (insert + select + delete user)
  • Independent code review passed, findings remediated
  • All monorepo gates green (typecheck, lint, format)

Closes #3

## Summary - Implements P0-003: shared database package with Drizzle ORM - 13 tables: auth (BetterAuth-compatible), brain entities, chat - createDb() factory with pool cleanup, runMigrations() with try/finally - Full FK relationships and indexes on query-hot columns - drizzle-kit generate/push/migrate/studio scripts ## Verification - Schema pushed to PG 17, all 13 tables created - CRUD round-trip tested (insert + select + delete user) - Independent code review passed, findings remediated - All monorepo gates green (typecheck, lint, format) Closes #3
jason.woltje added 1 commit 2026-03-13 02:17:13 +00:00
Implements P0-003: shared database package with Drizzle ORM.

Schema: 13 tables across 3 domains:
- Auth (BetterAuth-compatible): users, sessions, accounts, verifications
- Brain: projects, missions, tasks, events, agents, tickets, appreciations
- Chat: conversations, messages

Features:
- createDb() factory with pool cleanup via DbHandle.close()
- runMigrations() with try/finally for connection safety
- drizzle-kit config for generate/push/migrate/studio
- Full FK relationships and indexes on query-hot columns
- ESM package with NodeNext resolution

Verified: schema pushed to PG 17, CRUD round-trip tested.

Closes #3

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jason.woltje merged commit 2b1723e898 into main 2026-03-13 02:17:19 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#67