fix: pass config object directly to PrismaLibSql, drop @libsql/client
PrismaLibSql constructor takes a Config object (with url), not a pre-created Client instance. Remove the unnecessary createClient call and the @libsql/client direct dependency. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
import { PrismaLibSql } from '@prisma/adapter-libsql'
|
||||
import { createClient } from '@libsql/client'
|
||||
|
||||
const globalForPrisma = globalThis as unknown as {
|
||||
prisma: PrismaClient | undefined
|
||||
@@ -8,10 +7,9 @@ const globalForPrisma = globalThis as unknown as {
|
||||
|
||||
function getPrismaClient(): PrismaClient {
|
||||
if (!globalForPrisma.prisma) {
|
||||
const libsql = createClient({
|
||||
const adapter = new PrismaLibSql({
|
||||
url: process.env.DATABASE_URL ?? 'file:./dev.db',
|
||||
})
|
||||
const adapter = new PrismaLibSql(libsql)
|
||||
globalForPrisma.prisma = new PrismaClient({
|
||||
adapter,
|
||||
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
|
||||
|
||||
Reference in New Issue
Block a user