Skip to content

Commit a9c2dc5

Browse files
fix(cli): update prisma postgres db setup (#693)
1 parent b9685e7 commit a9c2dc5

File tree

6 files changed

+11
-45
lines changed

6 files changed

+11
-45
lines changed

apps/cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Follow the prompts to configure your project or use the `--yes` flag for default
3838
| **Runtime** | • Bun<br>• Node.js<br>• Cloudflare Workers<br>• None |
3939
| **Database** | • SQLite<br>• PostgreSQL<br>• MySQL<br>• MongoDB<br>• None |
4040
| **ORM** | • Drizzle (TypeScript-first)<br>• Prisma (feature-rich)<br>• Mongoose (for MongoDB)<br>• None |
41-
| **Database Setup** | • Turso (SQLite)<br>• Cloudflare D1 (SQLite)<br>• Neon (PostgreSQL)<br>• Supabase (PostgreSQL)<br>• Prisma Postgres (via Prisma Accelerate)<br>• MongoDB Atlas<br>• None (manual setup) |
41+
| **Database Setup** | • Turso (SQLite)<br>• Cloudflare D1 (SQLite)<br>• Neon (PostgreSQL)<br>• Supabase (PostgreSQL)<br>• Prisma Postgres<br>• MongoDB Atlas<br>• None (manual setup) |
4242
| **Authentication** | Better-Auth (email/password, with more options coming soon) |
4343
| **Styling** | Tailwind CSS with shadcn/ui components |
4444
| **Addons** | • PWA support<br>• Tauri (desktop applications)<br>• Starlight (documentation site)<br>• Biome (linting and formatting)<br>• Husky (Git hooks)<br>• Turborepo (optimized builds) |

apps/cli/src/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export const dependencyVersionMap = {
6565
"@prisma/client": "^6.15.0",
6666
prisma: "^6.15.0",
6767
"@prisma/adapter-d1": "^6.15.0",
68-
"@prisma/extension-accelerate": "^2.0.2",
6968
"@prisma/adapter-libsql": "^6.15.0",
7069

7170
"@prisma/adapter-planetscale": "^6.15.0",

apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { consola } from "consola";
44
import { execa } from "execa";
55
import fs from "fs-extra";
66
import pc from "picocolors";
7-
import type { ORM, PackageManager, ProjectConfig } from "../../types";
8-
import { addPackageDependency } from "../../utils/add-package-deps";
7+
import type { PackageManager, ProjectConfig } from "../../types";
98
import { exitCancelled } from "../../utils/errors";
109
import { getPackageExecutionCommand } from "../../utils/package-runner";
1110
import { addEnvVariablesToFile, type EnvVariable } from "../core/env-setup";
@@ -37,7 +36,6 @@ const AVAILABLE_REGIONS = [
3736
async function setupWithCreateDb(
3837
serverDir: string,
3938
packageManager: PackageManager,
40-
orm: ORM,
4139
) {
4240
try {
4341
log.info("Starting Prisma Postgres setup with create-db.");
@@ -73,13 +71,8 @@ async function setupWithCreateDb(
7371
return null;
7472
}
7573

76-
const databaseUrl =
77-
orm === "drizzle"
78-
? createDbResponse.directConnectionString
79-
: createDbResponse.connectionString;
80-
8174
return {
82-
databaseUrl,
75+
databaseUrl: createDbResponse.connectionString,
8376
claimUrl: createDbResponse.claimUrl,
8477
};
8578
} catch (error) {
@@ -113,16 +106,16 @@ async function initPrismaDatabase(
113106

114107
log.info(
115108
pc.yellow(
116-
"Please copy the Prisma Postgres URL from the output above.\nIt looks like: prisma+postgres://accelerate.prisma-data.net/?api_key=...",
109+
"Please copy the Prisma Postgres URL.\nIt looks like: postgresql://user:password@host:5432/db?sslmode=require",
117110
),
118111
);
119112

120113
const databaseUrl = await text({
121114
message: "Paste your Prisma Postgres database URL:",
122115
validate(value) {
123116
if (!value) return "Please enter a database URL";
124-
if (!value.startsWith("prisma+postgres://")) {
125-
return "URL should start with prisma+postgres://";
117+
if (!value.startsWith("postgresql://")) {
118+
return "URL should start with postgresql://";
126119
}
127120
},
128121
});
@@ -202,23 +195,6 @@ function displayManualSetupInstructions(target: "apps/web" | "apps/server") {
202195
DATABASE_URL="your_database_url"`);
203196
}
204197

205-
async function addPrismaAccelerateExtension(projectDir: string) {
206-
try {
207-
const dbPackageDir = path.join(projectDir, "packages/db");
208-
await addPackageDependency({
209-
dependencies: ["@prisma/extension-accelerate"],
210-
projectDir: dbPackageDir,
211-
});
212-
213-
return true;
214-
} catch (_error) {
215-
log.warn(
216-
pc.yellow("Could not add Prisma Accelerate extension automatically"),
217-
);
218-
return false;
219-
}
220-
}
221-
222198
export async function setupPrismaPostgres(
223199
config: ProjectConfig,
224200
cliInput?: { manualDb?: boolean },
@@ -292,7 +268,7 @@ export async function setupPrismaPostgres(
292268
let prismaConfig: PrismaConfig | null = null;
293269

294270
if (setupMethod === "create-db") {
295-
prismaConfig = await setupWithCreateDb(dbDir, packageManager, orm);
271+
prismaConfig = await setupWithCreateDb(dbDir, packageManager);
296272
} else {
297273
prismaConfig = await initPrismaDatabase(dbDir, packageManager);
298274
}
@@ -302,15 +278,10 @@ export async function setupPrismaPostgres(
302278

303279
if (orm === "prisma") {
304280
await addDotenvImportToPrismaConfig(projectDir, backend);
305-
await addPrismaAccelerateExtension(projectDir);
306281
}
307282

308-
const connectionType =
309-
orm === "drizzle" ? "direct connection" : "Prisma Accelerate";
310283
log.success(
311-
pc.green(
312-
`Prisma Postgres database configured successfully with ${connectionType}!`,
313-
),
284+
pc.green("Prisma Postgres database configured successfully!"),
314285
);
315286

316287
if (prismaConfig.claimUrl) {
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import { PrismaClient } from "../prisma/generated/client";
2-
{{#if (and (eq dbSetup "prisma-postgres") (eq orm "prisma"))}}
3-
import { withAccelerate } from "@prisma/extension-accelerate";
42

5-
const prisma = new PrismaClient().$extends(withAccelerate());
6-
{{else}}
73
const prisma = new PrismaClient();
8-
{{/if}}
94

105
export default prisma;

apps/web/content/docs/cli/options.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Database hosting/setup provider:
131131
- `d1`: Cloudflare D1 (SQLite)
132132
- `neon`: Neon (PostgreSQL)
133133
- `supabase`: Supabase (PostgreSQL)
134-
- `prisma-postgres`: Prisma Postgres via Prisma Accelerate
134+
- `prisma-postgres`: Prisma Postgres
135135
- `mongodb-atlas`: MongoDB Atlas
136136
- `docker`: Local Docker containers
137137

apps/web/src/app/global.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
.react-tweet-theme {
99
--tweet-container-margin: 0 !important;
10-
@apply !bg-fd-background !border-none !h-full !border-transparent !w-full;
10+
@apply bg-fd-background! border-none! h-full! border-transparent! w-full!;
1111
max-width: 100% !important;
1212
min-width: 0 !important;
1313
}
@@ -231,6 +231,7 @@
231231
.dark {
232232
--color-fd-primary: #cba6f7;
233233
--color-fd-primary-foreground: #11111b;
234+
--color-fd-background: #0D0D0D;
234235
--background: #11111b;
235236
--foreground: #cdd6f4;
236237
--card: #11111b;

0 commit comments

Comments
 (0)