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:
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "@mosaic/db",
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
@@ -13,10 +14,21 @@
|
||||
"build": "tsc",
|
||||
"lint": "eslint src",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"test": "vitest run"
|
||||
"test": "vitest run",
|
||||
"db:generate": "drizzle-kit generate",
|
||||
"db:migrate": "drizzle-kit migrate",
|
||||
"db:push": "drizzle-kit push",
|
||||
"db:studio": "drizzle-kit studio"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.0.0",
|
||||
"drizzle-kit": "^0.31.9",
|
||||
"tsx": "^4.0.0",
|
||||
"typescript": "^5.8.0",
|
||||
"vitest": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"drizzle-orm": "^0.45.1",
|
||||
"postgres": "^3.4.8"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user