Hey guys, is it possible to run a prisma migration and pass the database URL as a cli argument?
👀 1
r
Ryan
02/12/2021, 7:43 AM
@Dustin 👋
That’s not possible, but you can pass the env variable directly via:
Copy code
DATABASE_URL=url npx prisma migrate
And this should cover your use case instead of passing it as a CLI argument
plus one +1 1
d
Dustin
02/12/2021, 10:54 AM
Hey Ryan! Cheers for that.
I actually struggled for hours getting migrate to work in my GCP Cloud Build flow. It was almost entirely due to limitations with Cloud Build, particularly when trying to get my secrets from Secret Manager into Prisma. I tried the above but for some reason it wouldn't work. I ended up having a step that writes the database url into the schema file, migrates, and then writes back the env("database_url"). Bit of a pain but its working now.
💯 1
r
Ryan
02/12/2021, 10:56 AM
Great! Although passing the env in directly in the script should work though.