Skip to content

feat(cli): Upgrade to Prisma 6.13.0 #431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/cli/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const DEFAULT_CONFIG: ProjectConfig = {
};

export const dependencyVersionMap = {
"better-auth": "^1.3.0",
"@better-auth/expo": "^1.3.0",
"better-auth": "^1.3.4",
"@better-auth/expo": "^1.3.4",

"drizzle-orm": "^0.44.2",
"drizzle-kit": "^0.31.2",
Expand All @@ -44,8 +44,8 @@ export const dependencyVersionMap = {

mysql2: "^3.14.0",

"@prisma/client": "^6.12.0",
prisma: "^6.12.0",
"@prisma/client": "^6.13.0",
prisma: "^6.13.0",
Comment on lines +47 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify Prisma 6.13.0 compatibility and changelog.

The Prisma version upgrade to 6.13.0 aligns with the PR objectives. Ensure this version is compatible with the configuration changes made to the templates.


🌐 Web query:

What are the key changes and breaking changes in Prisma 6.13.0?

💡 Result:

As of July 29, 2025, Prisma ORM has not released a version 6.13.0. The latest stable release is 6.12.0, which introduced several notable features and improvements.

Key Changes in Prisma ORM 6.12.0:

  • ESM-Compatible prisma-client Generator (Preview): The new prisma-client generator offers enhanced flexibility and control over the generated Prisma Client code. It supports ECMAScript Modules (ESM) and allows developers to specify the output directory, moving away from the previous automatic generation into node_modules. (prisma.io)

  • TypeScript-Based Configuration with prisma.config.ts (Early Access): Prisma ORM now supports a TypeScript-based configuration file, prisma.config.ts, enabling developers to write custom code for configuration purposes. This feature is in Early Access and provides greater flexibility in managing Prisma's settings. (prisma.io)

  • Case-Insensitive Mode in JSON Filters: Developers can now perform case-insensitive filtering on JSON data using the mode option with values like "insensitive". This enhancement simplifies queries that need to be case-insensitive. (prisma.io)

  • Improved CockroachDB Migration Speed: Optimizations have been made to the migration engine, resulting in significantly faster migrations for CockroachDB. (prisma.io)

Breaking Changes:

  • Deprecation of NotFoundError: The NotFoundError has been removed in favor of PrismaClientKnownRequestError with error code P2025 in methods like findUniqueOrThrow() and findFirstOrThrow(). Developers should update their error handling code accordingly. (github.com)

  • Reserved Keywords for Model Names: The keywords async, await, and using are now reserved and cannot be used as model names in the Prisma schema. (github.com)

For a comprehensive list of changes and detailed information, please refer to the official Prisma changelog. (prisma.io)

Citations:


Action Required: Correct Prisma dependency versions

It looks like Prisma 6.13.0 isn’t publicly released yet—the latest stable is 6.12.0. Please update your dependencies to a valid version or confirm you intend to use a prerelease.

• File: apps/cli/src/constants.ts
Lines 47–48
Current:

"@prisma/client": "^6.13.0",
prisma: "^6.13.0",

Suggested fix:

"@prisma/client": "^6.12.0",
prisma: "^6.12.0",

• If you’re on an early-access or alpha build of 6.13.0, switch to the correct prerelease tag (e.g. 6.13.0-alpha.x) and document it.
• Verify compatibility against the official changelog once 6.13.0 is formally released.

🤖 Prompt for AI Agents
In apps/cli/src/constants.ts at lines 47-48, the Prisma dependency versions are
set to 6.13.0, which is not yet publicly released. Update both "@prisma/client"
and "prisma" versions to the latest stable 6.12.0, or if you intend to use a
prerelease, specify the correct prerelease tag like 6.13.0-alpha.x and document
this choice accordingly.

"@prisma/extension-accelerate": "^2.0.2",

mongoose: "^8.14.0",
Expand Down
35 changes: 22 additions & 13 deletions apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from "node:path";
import { cancel, isCancel, log, select, spinner, text } from "@clack/prompts";
import { cancel, isCancel, log, select, text } from "@clack/prompts";
import { consola } from "consola";
import { execa } from "execa";
import fs from "fs-extra";
Expand All @@ -23,7 +23,7 @@ async function setupWithCreateDb(
) {
try {
log.info(
"Starting Prisma PostgreSQL setup. Please follow the instructions below:",
"Starting Prisma Postgres setup. Please follow the instructions below:",
);

const createDbCommand = getPackageExecutionCommand(
Expand Down Expand Up @@ -149,6 +149,20 @@ async function writeEnvFile(projectDir: string, config?: PrismaConfig) {
}
}

async function addDotenvImportToPrismaConfig(projectDir: string) {
try {
const prismaConfigPath = path.join(
projectDir,
"apps/server/prisma.config.ts",
);
let content = await fs.readFile(prismaConfigPath, "utf8");
content = `import "dotenv/config";\n${content}`;
await fs.writeFile(prismaConfigPath, content);
} catch (_error) {
consola.error("Failed to update prisma.config.ts");
}
}

function displayManualSetupInstructions() {
log.info(`Manual Prisma PostgreSQL Setup Instructions:
Expand Down Expand Up @@ -226,7 +240,7 @@ export async function setupPrismaPostgres(config: ProjectConfig) {
}

const setupMethod = await select({
message: "Choose your Prisma setup method:",
message: "Choose your Prisma Postgres setup method:",
options: setupOptions,
initialValue: "create-db",
});
Expand All @@ -246,28 +260,23 @@ export async function setupPrismaPostgres(config: ProjectConfig) {

if (prismaConfig) {
await writeEnvFile(projectDir, prismaConfig);

await addDotenvImportToPrismaConfig(projectDir);

if (orm === "prisma") {
await addPrismaAccelerateExtension(serverDir);
log.info(
pc.cyan(
'NOTE: Make sure to uncomment `import "dotenv/config";` in `apps/server/src/prisma.config.ts` to load environment variables.',
),
);
}
log.success(
pc.green("Prisma PostgreSQL database configured successfully!"),
pc.green("Prisma Postgres database configured successfully!"),
);
} else {
const fallbackSpinner = spinner();
fallbackSpinner.start("Setting up fallback configuration...");
await writeEnvFile(projectDir);
fallbackSpinner.stop("Fallback configuration ready");
displayManualSetupInstructions();
}
} catch (error) {
consola.error(
pc.red(
`Error during Prisma PostgreSQL setup: ${
`Error during Prisma Postgres setup: ${
error instanceof Error ? error.message : String(error)
}`,
),
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/helpers/project-generation/env-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export async function setupEnvironmentVariables(config: ProjectConfig) {
if (config.runtime === "workers") {
databaseUrl = "http://127.0.0.1:8080";
} else {
databaseUrl = "file:./local.db";
databaseUrl = "file:../local.db";
}
break;
}
Expand Down
9 changes: 1 addition & 8 deletions apps/cli/src/helpers/project-generation/post-installation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ async function getDatabaseInstructions(
}

if (orm === "prisma") {
if (database === "sqlite") {
if (dbSetup === "turso") {
instructions.push(
`${pc.yellow(
"NOTE:",
Expand All @@ -262,13 +262,6 @@ async function getDatabaseInstructions(
);
}

if (runtime === "bun") {
instructions.push(
`${pc.yellow(
"NOTE:",
)} Prisma with Bun may require additional configuration. If you encounter errors,\nfollow the guidance provided in the error messages`,
);
}
if (database === "mongodb" && dbSetup === "docker") {
instructions.push(
`${pc.yellow(
Expand Down
4 changes: 2 additions & 2 deletions apps/cli/src/helpers/project-generation/project-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ async function updateServerPackageJson(
}

if (options.orm === "prisma") {
scripts["db:push"] = "prisma db push --schema ./prisma/schema";
scripts["db:push"] = "prisma db push";
scripts["db:studio"] = "prisma studio";
scripts["db:generate"] = "prisma generate --schema ./prisma/schema";
scripts["db:generate"] = "prisma generate";
scripts["db:migrate"] = "prisma migrate dev";
} else if (options.orm === "drizzle") {
scripts["db:push"] = "drizzle-kit push";
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/prompts/addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function getAddonDisplay(addon: Addons): { label: string; hint: string } {
hint = "High-performance build system";
break;
case "pwa":
label = "PWA (Progressive Web App)";
label = "PWA";
hint = "Make your app installable and work offline";
break;
case "tauri":
Expand Down
3 changes: 2 additions & 1 deletion apps/cli/templates/backend/server/next/package.json.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"next": "15.3.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"dotenv": "^16.5.0"
"dotenv": "^17.2.1"
},
{{#if (eq dbSetup 'supabase')}}
"trustedDependencies": [
Expand All @@ -21,6 +21,7 @@
"devDependencies": {
"@types/node": "^20",
"@types/react": "^19",
"zod": "^4.0.13",
"typescript": "^5"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@
"check-types": "tsc -b",
"compile": "bun build --compile --minify --sourcemap --bytecode ./src/index.ts --outfile server"
},
{{#if (eq orm 'prisma')}}
"prisma": {
"schema": "./schema"
},
{{/if}}
"dependencies": {
"dotenv": "^16.4.7",
"dotenv": "^17.2.1",
"zod": "^4.0.2"
},
{{#if (eq dbSetup 'supabase')}}
Expand Down
4 changes: 3 additions & 1 deletion apps/cli/templates/db/prisma/mongodb/prisma.config.ts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import path from "node:path";
import type { PrismaConfig } from "prisma";

export default {
earlyAccess: true,
schema: path.join("prisma", "schema"),
migrations: {
path: path.join("prisma", "migrations"),
}
} satisfies PrismaConfig;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import path from "node:path";
import type { PrismaConfig } from "prisma";

export default {
earlyAccess: true,
schema: path.join("prisma", "schema"),
migrations: {
path: path.join("prisma", "migrations"),
}
} satisfies PrismaConfig;
10 changes: 5 additions & 5 deletions apps/cli/templates/db/prisma/postgres/prisma.config.ts.hbs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{{#if (eq dbSetup "prisma-postgres")}}
// import "dotenv/config"; uncomment this to load .env
{{else}}
{{#unless (eq dbSetup "prisma-postgres")}}
import "dotenv/config";
{{/if}}
{{/unless}}
import path from "node:path";
import type { PrismaConfig } from "prisma";

export default {
earlyAccess: true,
schema: path.join("prisma", "schema"),
migrations: {
path: path.join("prisma", "migrations"),
}
} satisfies PrismaConfig;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import path from "node:path";
import type { PrismaConfig } from "prisma";

export default {
earlyAccess: true,
schema: path.join("prisma", "schema"),
migrations: {
path: path.join("prisma", "migrations"),
}
} satisfies PrismaConfig;
2 changes: 1 addition & 1 deletion apps/web/src/app/(home)/showcase/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";

import { Terminal } from "lucide-react";
import ShowcaseItem from "./_components/ShowcaseItem";
import Footer from "../_components/footer";
import ShowcaseItem from "./_components/ShowcaseItem";

const showcaseProjects = [
{
Expand Down