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
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"@hono/node-server": "^1.14.4",
|
||||
"@mantine/core": "^8.1.1",
|
||||
"@mantine/hooks": "^8.1.1",
|
||||
"@neondatabase/serverless": "^1.0.1",
|
||||
"@openrouter/ai-sdk-provider": "^1.1.2",
|
||||
"@sinclair/typebox": "^0.34.37",
|
||||
"@tabler/icons-react": "^3.34.1",
|
||||
@@ -33,6 +34,7 @@
|
||||
"hono": "^4.8.2",
|
||||
"immer": "^10.1.1",
|
||||
"kysely": "^0.28.2",
|
||||
"kysely-neon": "^2.0.1",
|
||||
"lowdb": "^7.0.1",
|
||||
"nanoid": "^5.1.5",
|
||||
"pg": "^8.16.3",
|
||||
|
||||
Generated
+34
@@ -26,6 +26,9 @@ importers:
|
||||
'@mantine/hooks':
|
||||
specifier: ^8.1.1
|
||||
version: 8.1.2(react@19.1.0)
|
||||
'@neondatabase/serverless':
|
||||
specifier: ^1.0.1
|
||||
version: 1.0.1
|
||||
'@openrouter/ai-sdk-provider':
|
||||
specifier: ^1.1.2
|
||||
version: 1.1.2(ai@5.0.9(zod@4.0.17))(zod@4.0.17)
|
||||
@@ -74,6 +77,9 @@ importers:
|
||||
kysely:
|
||||
specifier: ^0.28.2
|
||||
version: 0.28.2
|
||||
kysely-neon:
|
||||
specifier: ^2.0.1
|
||||
version: 2.0.1(@neondatabase/serverless@1.0.1)(kysely@0.28.2)
|
||||
lowdb:
|
||||
specifier: ^7.0.1
|
||||
version: 7.0.1
|
||||
@@ -980,6 +986,10 @@ packages:
|
||||
peerDependencies:
|
||||
react: ^18.x || ^19.x
|
||||
|
||||
'@neondatabase/serverless@1.0.1':
|
||||
resolution: {integrity: sha512-O6yC5TT0jbw86VZVkmnzCZJB0hfxBl0JJz6f+3KHoZabjb/X08r9eFA+vuY06z1/qaovykvdkrXYq3SPUuvogA==}
|
||||
engines: {node: '>=19.0.0'}
|
||||
|
||||
'@nodelib/fs.scandir@2.1.5':
|
||||
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
|
||||
engines: {node: '>= 8'}
|
||||
@@ -1225,6 +1235,9 @@ packages:
|
||||
'@types/node@20.19.1':
|
||||
resolution: {integrity: sha512-jJD50LtlD2dodAEO653i3YF04NWak6jN3ky+Ri3Em3mGR39/glWiboM/IePaRbgwSfqM1TpGXfAg8ohn/4dTgA==}
|
||||
|
||||
'@types/node@22.18.3':
|
||||
resolution: {integrity: sha512-gTVM8js2twdtqM+AE2PdGEe9zGQY4UvmFjan9rZcVb6FGdStfjWoWejdmy4CfWVO9rh5MiYQGZloKAGkJt8lMw==}
|
||||
|
||||
'@types/pg@8.15.4':
|
||||
resolution: {integrity: sha512-I6UNVBAoYbvuWkkU3oosC8yxqH21f4/Jc4DK71JLG3dT2mdlGe1z+ep/LQGXaKaOgcvUrsQoPRqfgtMcvZiJhg==}
|
||||
|
||||
@@ -1890,6 +1903,13 @@ packages:
|
||||
kuler@2.0.0:
|
||||
resolution: {integrity: sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==}
|
||||
|
||||
kysely-neon@2.0.1:
|
||||
resolution: {integrity: sha512-FxsLZl4f1aHF5jI9cr0iYPrcKb3teWFO3Qnk9vWJm9lQhkepL9DbODYANX8g77Q6op0VLIZEYGrIffX2nogPxQ==}
|
||||
engines: {node: '>=20'}
|
||||
peerDependencies:
|
||||
'@neondatabase/serverless': ^1
|
||||
kysely: ^0.28
|
||||
|
||||
kysely@0.28.2:
|
||||
resolution: {integrity: sha512-4YAVLoF0Sf0UTqlhgQMFU9iQECdah7n+13ANkiuVfRvlK+uI0Etbgd7bVP36dKlG+NXWbhGua8vnGt+sdhvT7A==}
|
||||
engines: {node: '>=18.0.0'}
|
||||
@@ -3801,6 +3821,11 @@ snapshots:
|
||||
dependencies:
|
||||
react: 19.1.0
|
||||
|
||||
'@neondatabase/serverless@1.0.1':
|
||||
dependencies:
|
||||
'@types/node': 22.18.3
|
||||
'@types/pg': 8.15.4
|
||||
|
||||
'@nodelib/fs.scandir@2.1.5':
|
||||
dependencies:
|
||||
'@nodelib/fs.stat': 2.0.5
|
||||
@@ -3994,6 +4019,10 @@ snapshots:
|
||||
dependencies:
|
||||
undici-types: 6.21.0
|
||||
|
||||
'@types/node@22.18.3':
|
||||
dependencies:
|
||||
undici-types: 6.21.0
|
||||
|
||||
'@types/pg@8.15.4':
|
||||
dependencies:
|
||||
'@types/node': 20.19.1
|
||||
@@ -4688,6 +4717,11 @@ snapshots:
|
||||
|
||||
kuler@2.0.0: {}
|
||||
|
||||
kysely-neon@2.0.1(@neondatabase/serverless@1.0.1)(kysely@0.28.2):
|
||||
dependencies:
|
||||
'@neondatabase/serverless': 1.0.1
|
||||
kysely: 0.28.2
|
||||
|
||||
kysely@0.28.2: {}
|
||||
|
||||
levn@0.4.1:
|
||||
|
||||
Reference in New Issue
Block a user