mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-19 13:55:31 -04:00
goodbye planetscale 🪦 hello turso 👋
This commit is contained in:
@@ -1,11 +1,21 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import { PrismaLibSQL } from "@prisma/adapter-libsql";
|
||||
import { createClient } from "@libsql/client";
|
||||
|
||||
// creating PrismaClient here prevents next.js from starting too many concurrent prisma instances and exhausting the
|
||||
// number of connection pools available (especially when hot reloading from `next dev`).
|
||||
// https://www.prisma.io/docs/guides/other/troubleshooting-orm/help-articles/nextjs-prisma-client-dev-practices
|
||||
|
||||
const prismaClientSingleton = () => {
|
||||
return new PrismaClient();
|
||||
const libsql = createClient({
|
||||
// TODO: use a local .db file for development. https://www.prisma.io/docs/orm/overview/databases/sqlite#connection-url
|
||||
url: `${process.env.TURSO_DATABASE_URL}`,
|
||||
authToken: `${process.env.TURSO_AUTH_TOKEN}`,
|
||||
});
|
||||
|
||||
const adapter = new PrismaLibSQL(libsql);
|
||||
|
||||
return new PrismaClient({ adapter });
|
||||
};
|
||||
|
||||
declare global {
|
||||
|
Reference in New Issue
Block a user