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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user