ok, suddenly I feel very stupid… (again) I am abou...
# orm-help
j
ok, suddenly I feel very stupid… (again) I am about to launch my migrated code that runs Prisma 3 to our stage environment. But I realize I can’t find any config for the DATABASE_URL, not in my env vars or in any .env file. May it be that it uses 127.0.0.1:3306 per default for provider mysql? At which stage does it read the env variable? Is it with prisma genrate? Or later in generated prisma client?
r
@Josef Henryson 👋
prisma generate
doesn’t need the env var at all.
Only when you run Migrate commands or the application itself.
j
but where should I config my connection string then?
for the application that is
does the application (prisma client) read it from the schema.prisma file?
I tried to open the schema.prisma file inside .prisma/client and modify the datasource url and got an error. So it seems it reads the env(“DATABASE_URL”). However, when I check my env vars there is no DATABASE_URL. So where does it get it from? @Ryan
r
You should edit the
schema.prisma
file in the
prisma
folder and not
.prisma/client
.
j
hmm, I tried to update the url in my schema.prisma file, but it still seems to use the one in .prisma/client
ah, I had to run prisma generate of course, I misunderstood you above when you said prisma generate doens’t need the env var
💯 1
still, whats best practice, is it to put the conn string in the DATABASE_URL env var? I’m not a nodejs dev originally, is there some good routine to set the env var when the server is deployed/started? To me the simplest solution seems to have separate schema.prisma files for stage/prod etc but that seems a bit awkward as well…
Ah, I think I got it now. DIscussed this with a colleague that had some experience with nodejs.
Thank you @Ryan!
🙌 1
r
Happy to help! So what did you go with finally?