forked from kleinrui/sub-box
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrizzle.config.ts
36 lines (32 loc) · 1.02 KB
/
drizzle.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { type Config } from "drizzle-kit";
import { env } from "@/env";
if (
(!env.CLOUDFLARE_ACCOUNT_ID ||
!env.CLOUDFLARE_D1_DATABASE_ID ||
!env.CLOUDFLARE_TOKEN) &&
(process.argv.includes("studio") ||
process.argv.includes("push") ||
process.argv.includes("migrate") ||
process.argv.includes("check"))
) {
throw new Error(
"CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_D1_DATABASE_ID, and CLOUDFLARE_TOKEN are required to run drizzle-kit studio|migrations|push|check commands",
);
}
/**
* It's not necessary to have valid the CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_D1_DATABASE_ID, and CLOUDFLARE_TOKEN
* to generate migrations
*/
export default {
schema: "./server/db/schema.ts",
verbose: true,
out: "./migrations",
dialect: "sqlite",
driver: "d1-http",
dbCredentials: {
accountId: env.CLOUDFLARE_ACCOUNT_ID ?? "sk_invalid",
databaseId: env.CLOUDFLARE_D1_DATABASE_ID ?? "sk_invalid",
token: env.CLOUDFLARE_TOKEN ?? "sk_invalid",
},
tablesFilter: [`t3-cloudflare_*`],
} satisfies Config;