michaelshimeles / nextjs-starter-kit

The Ulimate Nextjs Starter Kit. Build your next SAAS product of your dreams. Batteries included.
https://starter.rasmic.xyz/
MIT License
1.21k stars 293 forks source link

`npx prisma migrate dev` got an error #17

Open BrantonLiu opened 3 weeks ago

BrantonLiu commented 3 weeks ago

when I run

npx prisma migrate dev

got this error

Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": PostgreSQL database

Error: Prisma schema validation - (get-config wasm)
Error code: P1012
error: Environment variable not found: DIRECT_URL.
  -->  prisma\schema.prisma:8
   |
 7 |   url       = env("DATABASE_URL")
 8 |   directUrl = env("DIRECT_URL")
   |

Validation Error Count: 1
[Context: getConfig]

Prisma CLI Version : 5.21.1

What shall I do? Change these two lines in .env like this?

datasource db {
  provider  = "postgresql"
  url       = env("DATABASE_URL")
  directUrl = env("DIRECT_URL")
}
datasource db {
  provider  = "postgresql"
  url       = env("SUPABASE_URL")
  // directUrl = env("DIRECT_URL")
}

I try to keep going. I'll be back if encounter any error, or who can help me here. Thanks in advance!

w1redl4in commented 3 weeks ago

Just erase DIRECT_URL and use only DATABASE_URL.

Example:

datasource db {
  provider  = "postgresql"
  url       = env("DATABASE_URL")
}