Problem
Unable to run prisma migrate with dotenv-cli
Reproduction
$ dotenv -e .env prisma migrate save --experimental
Error: Please provide the --experimental flag to use this command.
This is my second Github issue. Apologise if it doesn't live up to standard.
This issue is perfect.
And unfortunately I can also confirm the problem:
C:\Users\Jan\Documents\throwaway\studioTestin2>npx prisma migrate save --experimental
Error: P1012
Get config
error: Environment variable not found: DATABASE_URL.
--> schema.prisma:7
|
6 | provider = "mysql"
7 | url = env("DATABASE_URL")
|
Validation Error Count: 1
C:\Users\Jan\Documents\throwaway\studioTestin2>npx dotenv -e .env npx prisma migrate save --experimental
Error: Please provide the --experimental flag to use this command.
(I moved my .env from next to the schema to the root of my project)
@janpio After looking it looks like it works as intended.
The problem here is that dotenv-cli doesn't pass flags like --experimental by default.
@mikkelsl To make it work change your command to:
# I added two dashes before the prisma command
dotenv -e .env -- prisma migrate save --experimental
This can be found in the README of dotenv-cli
Flags to the underlying command
If you want to pass flags to the inner command use -- after all the flags to dotenv-cli.
I created a PR to make it clearer in the docs https://github.com/prisma/docs/pull/834
Most helpful comment
@janpio After looking it looks like it works as intended.
The problem here is that
dotenv-clidoesn't pass flags like--experimentalby default.@mikkelsl To make it work change your command to:
This can be found in the README of
dotenv-cliI created a PR to make it clearer in the docs https://github.com/prisma/docs/pull/834