fix(db): swap @neondatabase/serverless for postgres.js (local dev support)

Neon serverless driver requires remote WebSocket — incompatible with local
PostgreSQL. Replaced with postgres.js (drizzle-orm/postgres-js) in db/index.ts,
scripts/seed.ts, and drizzle.config.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Chandler Copeland
2026-03-19 14:00:32 -06:00
parent 8bc09e4ea7
commit 0a75442af3
4 changed files with 49 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
import { drizzle } from "drizzle-orm/neon-http";
import { neon } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
import * as schema from "./schema";
type DrizzleDb = ReturnType<typeof createDb>;
@@ -9,8 +9,8 @@ function createDb() {
if (!url) {
throw new Error("DATABASE_URL environment variable is not set");
}
const sql = neon(url);
return drizzle({ client: sql, schema });
const client = postgres(url);
return drizzle({ client, schema });
}
// Lazy singleton — created on first use, not at module load time