feat(01-01): Drizzle schema + DB client + /health slice (GREEN)
- src/db/schema.ts: users, memberCredentials, calendars, calendarEvents tables - users: composite unique on oidc_iss+oidc_sub (D-10 identity) - calendar_events: separate dtstart_utc (TIMESTAMP) and dtstart_date (DATE) + allDay boolean (D-13) - src/db/client.ts: drizzle(mysql2 pool) singleton export `db` - drizzle.config.ts: dialect mysql, schema → migrations, dbCredentials from env - src/routes/health.ts: GET / with real SELECT 1 DB round-trip, 200 or 503 - src/index.ts: Hono app with /health mounted before auth, serveStatic for PWA - tests/health.test.ts: 2 tests pass (mocked DB); TDD GREEN gate - apps/pwa/src/App.tsx: React shell fetching /health via TanStack Query
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
// Source: https://orm.drizzle.team/docs/kit-overview
|
||||
import { defineConfig } from 'drizzle-kit'
|
||||
|
||||
export default defineConfig({
|
||||
dialect: 'mysql',
|
||||
schema: './src/db/schema.ts',
|
||||
out: './src/db/migrations',
|
||||
dbCredentials: {
|
||||
host: process.env.DB_HOST!,
|
||||
user: process.env.DB_USER!,
|
||||
password: process.env.DB_PASSWORD!,
|
||||
database: process.env.DB_NAME!,
|
||||
port: Number(process.env.DB_PORT ?? 3306),
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user