Skip to content

Commit

Permalink
feat: use pg
Browse files Browse the repository at this point in the history
  • Loading branch information
rishi-raj-jain committed Jun 3, 2024
1 parent c48208c commit cbaca8a
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 93 deletions.
193 changes: 104 additions & 89 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"fmt": "prettier --write '**/*' --ignore-unknown"
},
"dependencies": {
"@neondatabase/serverless": "^0.9.3",
"commander": "^12.1.0",
"pg": "^8.11.5",
"uuid": "^9.0.1"
},
"devDependencies": {
Expand Down
8 changes: 5 additions & 3 deletions src/version.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { neon } from '@neondatabase/serverless'
import pg from 'pg'
const { Client } = pg

export default async function getPostgresVersion(connectionString) {
const sql = neon(connectionString)
const rows = await sql`SHOW server_version`
const client = new Client({ connectionString })
await client.connect()
const { rows } = await client.query('SHOW server_version')
const version = rows[0].server_version
return version.substring(0, version.indexOf('.'))
}

0 comments on commit cbaca8a

Please sign in to comment.