Skip to content

Commit

Permalink
Use another neon driver (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciabad authored Jun 9, 2024
1 parent 0ac723a commit 0ad1cd1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/server/db/db.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import 'server-only'
import { env } from '~/env.mjs'

import { neon } from '@neondatabase/serverless'
import { drizzle as drizzleNeon, NeonHttpDatabase } from 'drizzle-orm/neon-http'
import { Pool } from '@neondatabase/serverless'
import {
drizzle as drizzleNeon,
NeonDatabase,
} from 'drizzle-orm/neon-serverless'
import { drizzle as drizzlePg } from 'drizzle-orm/postgres-js'
import postgres from 'postgres'
import * as schema from './schema'
Expand All @@ -13,5 +16,5 @@ export const db =
schema,
// TODO: Remove this unsafe type cast when this issue is fixed:
// https://github.com/drizzle-team/drizzle-orm/issues/1129
}) as unknown as NeonHttpDatabase<typeof schema>)
: drizzleNeon(neon(env.DATABASE_URL), { schema })
}) as unknown as NeonDatabase<typeof schema>)
: drizzleNeon(new Pool({ connectionString: env.DATABASE_URL }), { schema })

0 comments on commit 0ad1cd1

Please sign in to comment.