serverless-friendly postgres connection
This commit is contained in:
+14
-8
@@ -1,5 +1,7 @@
|
||||
import { Pool } from "pg";
|
||||
import { Kysely, PostgresDialect } from "kysely";
|
||||
// import { Pool } from "pg";
|
||||
import { neon } from "@neondatabase/serverless";
|
||||
import { Kysely /*PostgresDialect*/ } from "kysely";
|
||||
import { NeonDialect } from "kysely-neon";
|
||||
import type Database from "./generated/Database";
|
||||
import type {
|
||||
ConversationEntity,
|
||||
@@ -10,13 +12,17 @@ import type {
|
||||
import type { CommittedMessage } from "../types";
|
||||
import { env } from "../server/env.js";
|
||||
|
||||
export const pool = new Pool({
|
||||
connectionString: env.POSTGRES_CONNECTION_STRING as string,
|
||||
// channelBinding: require ?
|
||||
});
|
||||
// export const pool = new Pool({
|
||||
// connectionString: env.POSTGRES_CONNECTION_STRING as string,
|
||||
// // channelBinding: require ?
|
||||
// });
|
||||
|
||||
const dialect = new PostgresDialect({
|
||||
pool,
|
||||
// const dialect = new PostgresDialect({
|
||||
// pool,
|
||||
// });
|
||||
|
||||
const dialect = new NeonDialect({
|
||||
neon: neon(env.POSTGRES_CONNECTION_STRING as string),
|
||||
});
|
||||
|
||||
// Database interface is passed to Kysely's constructor, and from now on, Kysely
|
||||
|
||||
Reference in New Issue
Block a user