Skip to content

Commit 6d5e3a8

Browse files
fix(cli): use turso sqlite when workers with no db setup
1 parent 69d0451 commit 6d5e3a8

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

apps/cli/src/helpers/core/env-setup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ ${hasWeb ? "# npx convex env set SITE_URL http://localhost:3001\n" : ""}
352352
databaseUrl = "mongodb://localhost:27017/mydatabase";
353353
break;
354354
case "sqlite":
355-
if (config.runtime === "workers") {
355+
if (config.runtime === "workers" ||
356+
(webDeploy === "wrangler" || serverDeploy === "wrangler" || webDeploy === "alchemy" || serverDeploy === "alchemy")) {
356357
databaseUrl = "http://127.0.0.1:8080";
357358
} else {
358359
const dbAppDir = backend === "self" ? "apps/web" : "apps/server";

apps/cli/src/helpers/core/post-installation.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ export async function displayPostInstallInstructions(
126126
output += `${pc.cyan(`${stepCounter++}.`)} ${packageManager} install\n`;
127127
}
128128

129+
if (database === "sqlite" && dbSetup === "none" && (serverDeploy === "wrangler" || serverDeploy === "alchemy" || webDeploy === "wrangler" || webDeploy === "alchemy")) {
130+
output += `${pc.cyan(`${stepCounter++}.`)} ${runCmd} db:local\n${pc.dim(
131+
" (starts local SQLite server for Workers compatibility)",
132+
)}\n`;
133+
}
134+
129135
if (isConvex) {
130136
output += `${pc.cyan(`${stepCounter++}.`)} ${runCmd} dev:setup\n${pc.dim(
131137
" (this will guide you through Convex project setup)",
@@ -381,14 +387,6 @@ async function getDatabaseInstructions(
381387
`${pc.cyan("•")} Database UI: ${`${runCmd} db:studio`}`,
382388
);
383389
}
384-
if (database === "sqlite" && dbSetup !== "d1") {
385-
const dbLocalPath = backend === "self" ? "apps/web" : "apps/server";
386-
instructions.push(
387-
`${pc.cyan(
388-
"•",
389-
)} Start local DB (if needed): ${`cd ${dbLocalPath} && ${runCmd} db:local`}`,
390-
);
391-
}
392390
} else if (orm === "mongoose") {
393391
if (dbSetup === "docker") {
394392
instructions.push(

0 commit comments

Comments
 (0)