From bbd603e2ccb8f1f0bef33f53cf6575bd72757748 Mon Sep 17 00:00:00 2001 From: Gregory Boch Date: Tue, 3 Mar 2026 19:12:19 +0100 Subject: [PATCH] chore(cli): replace Accelerate CTA with create-db in generated schema (#29147) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Replaces the Prisma Accelerate comment in generated `schema.prisma` files with a CTA pointing to `npx create-db` for quickly getting a Postgres database - Updates the comment from the two-line Accelerate promotion to a concise single-line: `// Get a free Postgres database in seconds: \`npx create-db\`` - Renames internal variables (`aboutAccelerate` → `aboutCreateDb`, `isProviderCompatibleWithAccelerate` → `showCreateDbCta`) to reflect the new purpose - Updates all 16 test snapshots to match ## Test plan - [x] All 22 existing `Init.test.ts` tests pass (67 snapshots matched) - [ ] `Lint` CI workflow passes - [ ] `CLI commands` CI workflow passes - [ ] `All pkgs (win+mac)` CI workflow passes 🤖 Generated with [Claude Code](https://claude.com/claude-code) ## Summary by CodeRabbit * **Bug Fixes** * The CLI consistently displays a post-generation hint to create a free Postgres database ("npx create-db"), regardless of the selected datasource provider. * Removed previous conditional behavior so the guidance is now reliably present after project generation. * Improves clarity for users seeking a quick hosted Postgres setup. Co-authored-by: Claude (claude-opus-4-6) Co-authored-by: jacek-prisma --- packages/cli/src/Init.ts | 9 ++-- .../__tests__/__snapshots__/Init.test.ts.snap | 52 +++++++------------ 2 files changed, 23 insertions(+), 38 deletions(-) diff --git a/packages/cli/src/Init.ts b/packages/cli/src/Init.ts index f10907f14f9b..346b46f9168e 100644 --- a/packages/cli/src/Init.ts +++ b/packages/cli/src/Init.ts @@ -59,14 +59,11 @@ export const defaultSchema = (props?: { withModel = false, } = props ?? {} - const aboutAccelerate = `\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n` - - const isProviderCompatibleWithAccelerate = datasourceProvider !== 'sqlite' - let schema = `// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -${isProviderCompatibleWithAccelerate ? aboutAccelerate : ''} + +// Get a free hosted Postgres database in seconds: \`npx create-db\` + generator client { provider = "${generatorProvider}" ${ diff --git a/packages/cli/src/__tests__/__snapshots__/Init.test.ts.snap b/packages/cli/src/__tests__/__snapshots__/Init.test.ts.snap index e8021bbfa828..15b680194c14 100644 --- a/packages/cli/src/__tests__/__snapshots__/Init.test.ts.snap +++ b/packages/cli/src/__tests__/__snapshots__/Init.test.ts.snap @@ -29,8 +29,7 @@ exports[`appends when .env present 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "prisma-client" @@ -115,8 +114,7 @@ exports[`is schema and env written on disk replace 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "prisma-client" @@ -178,8 +176,7 @@ exports[`warns when DATABASE_URL present in .env 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "prisma-client" @@ -234,8 +231,7 @@ exports[`works with --with-model param cockroachdb 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "prisma-client" @@ -296,8 +292,7 @@ exports[`works with --with-model param mongodb 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "prisma-client" @@ -364,8 +359,7 @@ exports[`works with --with-model param postgresql 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "prisma-client" @@ -432,8 +426,7 @@ exports[`works with custom output 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "prisma-client" @@ -494,8 +487,7 @@ exports[`works with generator param - \`go run github.com/steebchen/prisma-clien "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "go run github.com/steebchen/prisma-client-go" @@ -556,8 +548,7 @@ exports[`works with preview features - mock test 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "prisma-client" @@ -619,8 +610,7 @@ exports[`works with preview features - multiple 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "prisma-client" @@ -676,8 +666,7 @@ exports[`works with provider and url params - cockroachdb 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "prisma-client" @@ -732,8 +721,7 @@ exports[`works with provider param - MongoDB 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "prisma-client" @@ -788,6 +776,8 @@ exports[`works with provider param - SQLITE 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema +// Get a free hosted Postgres database in seconds: \`npx create-db\` + generator client { provider = "prisma-client" output = "../generated/prisma" @@ -841,8 +831,7 @@ exports[`works with provider param - SqlServer 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "prisma-client" @@ -897,8 +886,7 @@ exports[`works with provider param - cockroachdb 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "prisma-client" @@ -953,8 +941,7 @@ exports[`works with provider param - mysql 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "prisma-client" @@ -1015,8 +1002,7 @@ exports[`works with provider param - postgresql 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema -// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions? -// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init +// Get a free hosted Postgres database in seconds: \`npx create-db\` generator client { provider = "prisma-client" @@ -1053,6 +1039,8 @@ exports[`works with url param 2`] = ` "// This is your Prisma schema file, // learn more about it in the docs: https://pris.ly/d/prisma-schema +// Get a free hosted Postgres database in seconds: \`npx create-db\` + generator client { provider = "prisma-client" output = "../generated/prisma"