Skip to content

Commit 16c4d42

Browse files
feat(cli): Upgrade to Prisma 6.13.0 (#431)
1 parent ec808ff commit 16c4d42

File tree

13 files changed

+53
-44
lines changed

13 files changed

+53
-44
lines changed

.changeset/legal-bears-feel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-better-t-stack": patch
3+
---
4+
5+
Upgrade to Prisma 6.13.0

apps/cli/src/constants.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export const DEFAULT_CONFIG: ProjectConfig = {
2828
};
2929

3030
export const dependencyVersionMap = {
31-
"better-auth": "^1.3.0",
32-
"@better-auth/expo": "^1.3.0",
31+
"better-auth": "^1.3.4",
32+
"@better-auth/expo": "^1.3.4",
3333

3434
"drizzle-orm": "^0.44.2",
3535
"drizzle-kit": "^0.31.2",
@@ -44,8 +44,8 @@ export const dependencyVersionMap = {
4444

4545
mysql2: "^3.14.0",
4646

47-
"@prisma/client": "^6.12.0",
48-
prisma: "^6.12.0",
47+
"@prisma/client": "^6.13.0",
48+
prisma: "^6.13.0",
4949
"@prisma/extension-accelerate": "^2.0.2",
5050

5151
mongoose: "^8.14.0",

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

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import path from "node:path";
2-
import { cancel, isCancel, log, select, spinner, text } from "@clack/prompts";
2+
import { cancel, isCancel, log, select, text } from "@clack/prompts";
33
import { consola } from "consola";
44
import { execa } from "execa";
55
import fs from "fs-extra";
@@ -23,7 +23,7 @@ async function setupWithCreateDb(
2323
) {
2424
try {
2525
log.info(
26-
"Starting Prisma PostgreSQL setup. Please follow the instructions below:",
26+
"Starting Prisma Postgres setup. Please follow the instructions below:",
2727
);
2828

2929
const createDbCommand = getPackageExecutionCommand(
@@ -149,6 +149,20 @@ async function writeEnvFile(projectDir: string, config?: PrismaConfig) {
149149
}
150150
}
151151

152+
async function addDotenvImportToPrismaConfig(projectDir: string) {
153+
try {
154+
const prismaConfigPath = path.join(
155+
projectDir,
156+
"apps/server/prisma.config.ts",
157+
);
158+
let content = await fs.readFile(prismaConfigPath, "utf8");
159+
content = `import "dotenv/config";\n${content}`;
160+
await fs.writeFile(prismaConfigPath, content);
161+
} catch (_error) {
162+
consola.error("Failed to update prisma.config.ts");
163+
}
164+
}
165+
152166
function displayManualSetupInstructions() {
153167
log.info(`Manual Prisma PostgreSQL Setup Instructions:
154168
@@ -226,7 +240,7 @@ export async function setupPrismaPostgres(config: ProjectConfig) {
226240
}
227241

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

247261
if (prismaConfig) {
248262
await writeEnvFile(projectDir, prismaConfig);
263+
264+
await addDotenvImportToPrismaConfig(projectDir);
265+
249266
if (orm === "prisma") {
250267
await addPrismaAccelerateExtension(serverDir);
251-
log.info(
252-
pc.cyan(
253-
'NOTE: Make sure to uncomment `import "dotenv/config";` in `apps/server/src/prisma.config.ts` to load environment variables.',
254-
),
255-
);
256268
}
257269
log.success(
258-
pc.green("Prisma PostgreSQL database configured successfully!"),
270+
pc.green("Prisma Postgres database configured successfully!"),
259271
);
260272
} else {
261-
const fallbackSpinner = spinner();
262-
fallbackSpinner.start("Setting up fallback configuration...");
263273
await writeEnvFile(projectDir);
264-
fallbackSpinner.stop("Fallback configuration ready");
265274
displayManualSetupInstructions();
266275
}
267276
} catch (error) {
268277
consola.error(
269278
pc.red(
270-
`Error during Prisma PostgreSQL setup: ${
279+
`Error during Prisma Postgres setup: ${
271280
error instanceof Error ? error.message : String(error)
272281
}`,
273282
),

apps/cli/src/helpers/project-generation/post-installation.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ async function getDatabaseInstructions(
253253
}
254254

255255
if (orm === "prisma") {
256-
if (database === "sqlite") {
256+
if (dbSetup === "turso") {
257257
instructions.push(
258258
`${pc.yellow(
259259
"NOTE:",
@@ -262,13 +262,6 @@ async function getDatabaseInstructions(
262262
);
263263
}
264264

265-
if (runtime === "bun") {
266-
instructions.push(
267-
`${pc.yellow(
268-
"NOTE:",
269-
)} Prisma with Bun may require additional configuration. If you encounter errors,\nfollow the guidance provided in the error messages`,
270-
);
271-
}
272265
if (database === "mongodb" && dbSetup === "docker") {
273266
instructions.push(
274267
`${pc.yellow(

apps/cli/src/helpers/project-generation/project-config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ async function updateServerPackageJson(
248248
}
249249

250250
if (options.orm === "prisma") {
251-
scripts["db:push"] = "prisma db push --schema ./prisma/schema";
251+
scripts["db:push"] = "prisma db push";
252252
scripts["db:studio"] = "prisma studio";
253-
scripts["db:generate"] = "prisma generate --schema ./prisma/schema";
253+
scripts["db:generate"] = "prisma generate";
254254
scripts["db:migrate"] = "prisma migrate dev";
255255
} else if (options.orm === "drizzle") {
256256
scripts["db:push"] = "drizzle-kit push";

apps/cli/src/prompts/addons.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function getAddonDisplay(addon: Addons): { label: string; hint: string } {
2323
hint = "High-performance build system";
2424
break;
2525
case "pwa":
26-
label = "PWA (Progressive Web App)";
26+
label = "PWA";
2727
hint = "Make your app installable and work offline";
2828
break;
2929
case "tauri":

apps/cli/templates/backend/server/next/package.json.hbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"next": "15.3.0",
1212
"react": "^19.0.0",
1313
"react-dom": "^19.0.0",
14-
"dotenv": "^16.5.0"
14+
"dotenv": "^17.2.1"
1515
},
1616
{{#if (eq dbSetup 'supabase')}}
1717
"trustedDependencies": [
@@ -21,6 +21,7 @@
2121
"devDependencies": {
2222
"@types/node": "^20",
2323
"@types/react": "^19",
24+
"zod": "^4.0.13",
2425
"typescript": "^5"
2526
}
2627
}

apps/cli/templates/backend/server/server-base/package.json.hbs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,8 @@
77
"check-types": "tsc -b",
88
"compile": "bun build --compile --minify --sourcemap --bytecode ./src/index.ts --outfile server"
99
},
10-
{{#if (eq orm 'prisma')}}
11-
"prisma": {
12-
"schema": "./schema"
13-
},
14-
{{/if}}
1510
"dependencies": {
16-
"dotenv": "^16.4.7",
11+
"dotenv": "^17.2.1",
1712
"zod": "^4.0.2"
1813
},
1914
{{#if (eq dbSetup 'supabase')}}

apps/cli/templates/db/prisma/mongodb/prisma.config.ts.hbs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import path from "node:path";
33
import type { PrismaConfig } from "prisma";
44

55
export default {
6-
earlyAccess: true,
76
schema: path.join("prisma", "schema"),
7+
migrations: {
8+
path: path.join("prisma", "migrations"),
9+
}
810
} satisfies PrismaConfig;

apps/cli/templates/db/prisma/mysql/prisma.config.ts renamed to apps/cli/templates/db/prisma/mysql/prisma.config.ts.hbs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import path from "node:path";
33
import type { PrismaConfig } from "prisma";
44

55
export default {
6-
earlyAccess: true,
76
schema: path.join("prisma", "schema"),
7+
migrations: {
8+
path: path.join("prisma", "migrations"),
9+
}
810
} satisfies PrismaConfig;

0 commit comments

Comments
 (0)