Add D1 Database (#335)

This commit is contained in:
Aman Varshney
2025-06-20 09:17:32 +05:30
committed by GitHub
parent 846d70583e
commit 0c5dd2efee
14 changed files with 214 additions and 15 deletions

View File

@@ -85,6 +85,7 @@ export async function gatherConfig(
flags.dbSetup,
results.orm,
results.backend,
results.runtime,
),
git: () => getGitChoice(flags.git),
packageManager: () => getPackageManagerChoice(flags.packageManager),

View File

@@ -1,12 +1,13 @@
import { cancel, isCancel, select } from "@clack/prompts";
import pc from "picocolors";
import type { Backend, DatabaseSetup, ORM } from "../types";
import type { Backend, DatabaseSetup, ORM, Runtime } from "../types";
export async function getDBSetupChoice(
databaseType: string,
dbSetup: DatabaseSetup | undefined,
orm?: ORM,
backend?: Backend,
runtime?: Runtime,
): Promise<DatabaseSetup> {
if (backend === "convex") {
return "none";
@@ -32,6 +33,15 @@ export async function getDBSetupChoice(
label: "Turso",
hint: "SQLite for Production. Powered by libSQL",
},
...(runtime === "workers"
? [
{
value: "d1" as const,
label: "Cloudflare D1",
hint: "Cloudflare's managed, serverless database with SQLite's SQL semantics",
},
]
: []),
{ value: "none" as const, label: "None", hint: "Manual setup" },
];
} else if (databaseType === "postgres") {