🎉 first commit

This commit is contained in:
LIlGG
2025-09-24 13:06:25 +08:00
commit 1f4fb103e9
409 changed files with 61222 additions and 0 deletions

22
app/lib/.server/prisma.ts Normal file
View File

@@ -0,0 +1,22 @@
import { PrismaClient } from '@prisma/client';
// 创建PrismaClient实例
let prisma: PrismaClient;
declare global {
var __db: PrismaClient | undefined;
}
// 在开发环境中使用全局变量,避免热重载时创建多个实例
if (process.env.NODE_ENV === 'production') {
prisma = new PrismaClient();
} else {
if (!global.__db) {
global.__db = new PrismaClient({
log: ['query', 'error', 'warn'],
});
}
prisma = global.__db;
}
export { prisma };