Hi everyone. I am trying to run migrations with pr...
# orm-help
d
Hi everyone. I am trying to run migrations with prisma and getting the following error. For more details, I have opened a discussion here https://github.com/prisma/prisma/discussions/12170 Thanks for your time and help.
Copy code
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Error: Get config: Schema Parsing P1012

error: Error validating datasource `db`: the URL must start with the protocol `postgresql://` or `postgres://`.
  -->  schema.prisma:10
   | 
 9 |   provider = "postgresql"
10 |   url      = env("DATABASE_URL")
   | 

Validation Error Count: 1
i
I also faced the same issue I am surprised the issue is reported here !
d
Were you able to resolve it?
i
Not really 😐
n
thats weird… try breaking down the .env DB_URL like this
DB_URL="postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?schema=${DB_SCHEMA}"
and see if you still get an error. could be somewhere you might be accidentally instantiating it in another .env file somewhere else in your repo
👀 1
b
So I think I have an potential answer for where the problem is for this but I don’t know anyway to undo the problem. At some point following a tutorial or something, I sourced a DATABASE_URL env variable in my shell. Now I have deleted the env variable from the shell but when I start a new project with prisma and it looks to my .env file in the root, the DATABASE_URL variable in the root level .env file is correct but the value is being over-ridden and I believe it is reading the sourced variable instead. Do we know of anyway to unsource variables? Right now I have to ‘hard code’ the db string in the prisma.schema file which is obviously not the best idea.