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

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>
This commit is contained in:
2026-03-12 21:16:52 -05:00
parent 573484c83e
commit de44a5cd43
13 changed files with 2451 additions and 5 deletions

View File

@@ -0,0 +1,13 @@
{
"version": "7",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "7",
"when": 1773368153122,
"tag": "0000_loud_ezekiel_stane",
"breakpoints": true
}
]
}