프리즈마 세팅팅

This commit is contained in:
wallace
2025-11-10 21:57:28 +09:00
parent 9a11a8afd1
commit 512acfb921
12 changed files with 1400 additions and 3 deletions

24
prisma.config.ts Normal file
View File

@@ -0,0 +1,24 @@
import { config } from "dotenv";
import { defineConfig } from "prisma/config";
import { resolve } from "path";
import { existsSync } from "fs";
// .env 파일을 명시적으로 로드
const envPath = resolve(process.cwd(), ".env");
if (existsSync(envPath)) {
config({ path: envPath });
}
// .env 파일에서 DATABASE_URL을 읽어옵니다 (기본값: file:./dev.db)
const databaseUrl = process.env.DATABASE_URL || "file:./dev.db";
export default defineConfig({
schema: "prisma/schema.prisma",
migrations: {
path: "prisma/migrations",
},
engine: "classic",
datasource: {
url: databaseUrl,
},
});