feat: migrate from SQLite to PostgreSQL - complete schema and API updates

- Remove better-sqlite3, add pg driver
- Convert schema to PostgreSQL types (serial, timestamp, boolean, jsonb)
- Generate fresh PostgreSQL migrations
- Update database connection layer with pg.Pool
- Fix all API routes: remove JSON.parse/stringify, use native timestamps and booleans
- Update drizzle.config.ts and .env.example for PostgreSQL
This commit is contained in:
Marko Djordjevic 2026-02-17 13:43:06 +01:00
parent 4605283d2b
commit 5f70f13da3
37 changed files with 1164 additions and 1825 deletions

View file

@ -45,7 +45,7 @@ export async function GET(request: NextRequest) {
price = candleResult[0].close;
}
} else if (annotation.label_type === 'line' && annotation.geometry) {
const geometry = JSON.parse(annotation.geometry);
const geometry = annotation.geometry as any;
price = geometry.startPrice || null;
}

View file

@ -44,7 +44,7 @@ export async function GET(request: NextRequest) {
confidence: span.confidence,
outcome: span.outcome,
notes: span.notes,
sub_spans: span.sub_spans ? JSON.parse(span.sub_spans as string) : null,
sub_spans: span.sub_spans,
color: span.color,
created_at: span.created_at,
})),