mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
39 lines
992 B
Handlebars
39 lines
992 B
Handlebars
import "dotenv/config";
|
|
import path from "node:path";
|
|
import type { PrismaConfig } from "prisma";
|
|
{{#if (eq dbSetup "d1")}}
|
|
import { PrismaD1 } from "@prisma/adapter-d1";
|
|
{{/if}}
|
|
{{#if (eq dbSetup "turso")}}
|
|
import { PrismaLibSQL } from "@prisma/adapter-libsql";
|
|
{{/if}}
|
|
|
|
export default {
|
|
{{#if (or (eq dbSetup "d1") (eq dbSetup "turso"))}}
|
|
experimental: {
|
|
adapter: true
|
|
},
|
|
{{/if}}
|
|
schema: path.join("prisma", "schema"),
|
|
migrations: {
|
|
path: path.join("prisma", "migrations"),
|
|
},
|
|
{{#if (eq dbSetup "d1")}}
|
|
async adapter() {
|
|
return new PrismaD1({
|
|
CLOUDFLARE_D1_TOKEN: process.env.CLOUDFLARE_D1_TOKEN,
|
|
CLOUDFLARE_ACCOUNT_ID: process.env.CLOUDFLARE_ACCOUNT_ID,
|
|
CLOUDFLARE_DATABASE_ID: process.env.CLOUDFLARE_DATABASE_ID,
|
|
});
|
|
},
|
|
{{/if}}
|
|
{{#if (eq dbSetup "turso")}}
|
|
async adapter() {
|
|
return new PrismaLibSQL({
|
|
url: process.env.DATABASE_URL || "",
|
|
authToken: process.env.DATABASE_AUTH_TOKEN,
|
|
});
|
|
},
|
|
{{/if}}
|
|
} satisfies PrismaConfig;
|