Skip to content

Commit bbd603e

Browse files
gregory-boch-prismaclaudejacek-prisma
authored
chore(cli): replace Accelerate CTA with create-db in generated schema (prisma#29147)
## 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) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## 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. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude (claude-opus-4-6) <noreply@anthropic.com> Co-authored-by: jacek-prisma <malec@prisma.io>
1 parent 1c96216 commit bbd603e

2 files changed

Lines changed: 23 additions & 38 deletions

File tree

packages/cli/src/Init.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,11 @@ export const defaultSchema = (props?: {
5959
withModel = false,
6060
} = props ?? {}
6161

62-
const aboutAccelerate = `\n// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
63-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init\n`
64-
65-
const isProviderCompatibleWithAccelerate = datasourceProvider !== 'sqlite'
66-
6762
let schema = `// This is your Prisma schema file,
6863
// learn more about it in the docs: https://pris.ly/d/prisma-schema
69-
${isProviderCompatibleWithAccelerate ? aboutAccelerate : ''}
64+
65+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
66+
7067
generator client {
7168
provider = "${generatorProvider}"
7269
${

packages/cli/src/__tests__/__snapshots__/Init.test.ts.snap

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ exports[`appends when .env present 2`] = `
2929
"// This is your Prisma schema file,
3030
// learn more about it in the docs: https://pris.ly/d/prisma-schema
3131
32-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
33-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
32+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
3433
3534
generator client {
3635
provider = "prisma-client"
@@ -115,8 +114,7 @@ exports[`is schema and env written on disk replace 2`] = `
115114
"// This is your Prisma schema file,
116115
// learn more about it in the docs: https://pris.ly/d/prisma-schema
117116
118-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
119-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
117+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
120118
121119
generator client {
122120
provider = "prisma-client"
@@ -178,8 +176,7 @@ exports[`warns when DATABASE_URL present in .env 2`] = `
178176
"// This is your Prisma schema file,
179177
// learn more about it in the docs: https://pris.ly/d/prisma-schema
180178
181-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
182-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
179+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
183180
184181
generator client {
185182
provider = "prisma-client"
@@ -234,8 +231,7 @@ exports[`works with --with-model param cockroachdb 2`] = `
234231
"// This is your Prisma schema file,
235232
// learn more about it in the docs: https://pris.ly/d/prisma-schema
236233
237-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
238-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
234+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
239235
240236
generator client {
241237
provider = "prisma-client"
@@ -296,8 +292,7 @@ exports[`works with --with-model param mongodb 2`] = `
296292
"// This is your Prisma schema file,
297293
// learn more about it in the docs: https://pris.ly/d/prisma-schema
298294
299-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
300-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
295+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
301296
302297
generator client {
303298
provider = "prisma-client"
@@ -364,8 +359,7 @@ exports[`works with --with-model param postgresql 2`] = `
364359
"// This is your Prisma schema file,
365360
// learn more about it in the docs: https://pris.ly/d/prisma-schema
366361
367-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
368-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
362+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
369363
370364
generator client {
371365
provider = "prisma-client"
@@ -432,8 +426,7 @@ exports[`works with custom output 2`] = `
432426
"// This is your Prisma schema file,
433427
// learn more about it in the docs: https://pris.ly/d/prisma-schema
434428
435-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
436-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
429+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
437430
438431
generator client {
439432
provider = "prisma-client"
@@ -494,8 +487,7 @@ exports[`works with generator param - \`go run github.com/steebchen/prisma-clien
494487
"// This is your Prisma schema file,
495488
// learn more about it in the docs: https://pris.ly/d/prisma-schema
496489
497-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
498-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
490+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
499491
500492
generator client {
501493
provider = "go run github.com/steebchen/prisma-client-go"
@@ -556,8 +548,7 @@ exports[`works with preview features - mock test 2`] = `
556548
"// This is your Prisma schema file,
557549
// learn more about it in the docs: https://pris.ly/d/prisma-schema
558550
559-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
560-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
551+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
561552
562553
generator client {
563554
provider = "prisma-client"
@@ -619,8 +610,7 @@ exports[`works with preview features - multiple 2`] = `
619610
"// This is your Prisma schema file,
620611
// learn more about it in the docs: https://pris.ly/d/prisma-schema
621612
622-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
623-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
613+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
624614
625615
generator client {
626616
provider = "prisma-client"
@@ -676,8 +666,7 @@ exports[`works with provider and url params - cockroachdb 2`] = `
676666
"// This is your Prisma schema file,
677667
// learn more about it in the docs: https://pris.ly/d/prisma-schema
678668
679-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
680-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
669+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
681670
682671
generator client {
683672
provider = "prisma-client"
@@ -732,8 +721,7 @@ exports[`works with provider param - MongoDB 2`] = `
732721
"// This is your Prisma schema file,
733722
// learn more about it in the docs: https://pris.ly/d/prisma-schema
734723
735-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
736-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
724+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
737725
738726
generator client {
739727
provider = "prisma-client"
@@ -788,6 +776,8 @@ exports[`works with provider param - SQLITE 2`] = `
788776
"// This is your Prisma schema file,
789777
// learn more about it in the docs: https://pris.ly/d/prisma-schema
790778
779+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
780+
791781
generator client {
792782
provider = "prisma-client"
793783
output = "../generated/prisma"
@@ -841,8 +831,7 @@ exports[`works with provider param - SqlServer 2`] = `
841831
"// This is your Prisma schema file,
842832
// learn more about it in the docs: https://pris.ly/d/prisma-schema
843833
844-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
845-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
834+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
846835
847836
generator client {
848837
provider = "prisma-client"
@@ -897,8 +886,7 @@ exports[`works with provider param - cockroachdb 2`] = `
897886
"// This is your Prisma schema file,
898887
// learn more about it in the docs: https://pris.ly/d/prisma-schema
899888
900-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
901-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
889+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
902890
903891
generator client {
904892
provider = "prisma-client"
@@ -953,8 +941,7 @@ exports[`works with provider param - mysql 2`] = `
953941
"// This is your Prisma schema file,
954942
// learn more about it in the docs: https://pris.ly/d/prisma-schema
955943
956-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
957-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
944+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
958945
959946
generator client {
960947
provider = "prisma-client"
@@ -1015,8 +1002,7 @@ exports[`works with provider param - postgresql 2`] = `
10151002
"// This is your Prisma schema file,
10161003
// learn more about it in the docs: https://pris.ly/d/prisma-schema
10171004
1018-
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
1019-
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
1005+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
10201006
10211007
generator client {
10221008
provider = "prisma-client"
@@ -1053,6 +1039,8 @@ exports[`works with url param 2`] = `
10531039
"// This is your Prisma schema file,
10541040
// learn more about it in the docs: https://pris.ly/d/prisma-schema
10551041
1042+
// Get a free hosted Postgres database in seconds: \`npx create-db\`
1043+
10561044
generator client {
10571045
provider = "prisma-client"
10581046
output = "../generated/prisma"

0 commit comments

Comments
 (0)