You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> **FOR AI ASSISTANTS**: This command is **interactive** and requires user input. You **MUST ask the user to run this command manually** in their own terminal, then **wait for them to confirm completion** before proceeding with the next steps. Do NOT attempt to run this command yourself.
187
+
124
188
```bash
125
-
# Initialize Prisma (creates prisma/schema.prisma and prisma.config.ts)
126
-
npx prisma init
189
+
# Initialize Prisma AND create a real Prisma Postgres cloud database
**IMPORTANT**: Ensure the generated `.env` uses a `postgres://` URL scheme. If it generates `prisma+postgres://`, replace it with the standard TCP connection string available in the Prisma Console.
203
+
204
+
```env
205
+
DATABASE_URL="postgres://..."
206
+
```
207
+
208
+
**IMPORTANT**: Do NOT use `npx prisma init` without `--db` as this only creates local files without a database.
130
209
131
210
## CORRECT PRISMA CONFIG (prisma.config.ts)
132
211
133
-
**CRITICAL**: After running `npx prisma init`, update the generated `prisma.config.ts`:
212
+
When using `npx prisma init --db`, the `prisma.config.ts` is **auto-generated** with the correct configuration:
134
213
135
214
```typescript
136
-
import "dotenv/config" // ✅ CRITICAL: Add this line at the top
215
+
import "dotenv/config" // ✅ Auto-included by prisma init --db
137
216
import { defineConfig, env } from "prisma/config"
138
217
139
218
export default defineConfig({
140
219
schema: "prisma/schema.prisma",
141
220
migrations: {
142
221
path: "prisma/migrations",
143
222
},
144
-
engine: "classic",
223
+
// ✅ NO engine property - removed in Prisma 7
145
224
datasource: {
146
225
url: env("DATABASE_URL"),
147
226
},
148
227
})
149
228
```
150
229
230
+
**Note**: If you need to manually create this file, ensure `import "dotenv/config"` is at the top.
2. **Initialize Prisma AND create Prisma Postgres database** (⚠️ USER MUST RUN MANUALLY):
442
+
443
+
> **AI ASSISTANT**: Ask the user to run this command in their own terminal. This is interactive and requires user input. Wait for the user to confirm completion before continuing.
4. Result in import errors that prevent compilation
420
544
5. Cause performance issues and connection failures
545
+
6. Fail with "HTTP connection string is not supported" errors when using local URLs
421
546
422
547
## USEFUL COMMANDS
423
548
424
549
```bash
425
550
# After changing schema
426
-
npx prisma generate # Regenerate client
551
+
npx prisma generate # Regenerate client (--no-engine flag no longer needed)
427
552
428
553
# Push schema to database (no migrations)
429
554
npx prisma db push
@@ -482,35 +607,15 @@ When asked about Prisma + Next.js implementation, you MUST:
482
607
8. ALWAYS add npm scripts for `db:test` and `db:studio`
483
608
9. ALWAYS include error handling in API routes and server components
484
609
10. ALWAYS use the global prisma instance from `lib/prisma.ts`
485
-
11. VERIFY your response against ALL the patterns shown here before responding
610
+
11. ALWAYS use `@prisma/adapter-pg` and `adapter` property
611
+
12. NEVER include `url` in the datasource block of schema.prisma
612
+
13. NEVER include `engine` property in prisma.config.ts
613
+
14. ALWAYS ask the user to run `npx prisma init --db --output ../app/generated/prisma` **manually in their own terminal** (this command is interactive and requires user input for region and project name)
614
+
15. ALWAYS wait for user confirmation after they run the interactive `prisma init --db` command before proceeding
615
+
16. NEVER attempt to run interactive commands yourself - ask the user to do it
616
+
17. NEVER use `prisma+postgres://` URLs - ONLY `postgres://` TCP URLs
617
+
18. NEVER manually invent or fabricate DATABASE_URL values
618
+
19. ALWAYS let Prisma generate the `.env` file with the real DATABASE_URL (and ensure it's correct type)
619
+
20. VERIFY your response against ALL the patterns shown here before responding
486
620
487
621
Remember: There are NO EXCEPTIONS to these rules. Every requirement is MANDATORY for the setup to work.
488
-
489
-
490
-
````
491
-
492
-
## Running the application
493
-
494
-
Get your application running locally in three quick steps:
495
-
496
-
**1. Generate the Prisma Client:**
497
-
498
-
```terminal
499
-
npx prisma generate --no-engine
500
-
```
501
-
502
-
**2. View your database in Prisma Studio:**
503
-
504
-
```terminal
505
-
npm run db:studio
506
-
```
507
-
508
-
Prisma Studio opens at `localhost:5555` where you can inspect your `User` table and see the test user stored in your database.
509
-
510
-
**3. Start your Next.js development server:**
511
-
512
-
```terminal
513
-
npm run dev
514
-
```
515
-
516
-
Visit `http://localhost:3000` to see your Next.js application live, displaying your first user fetched directly from your Prisma Postgres database!
0 commit comments