Skip to content

Overriding DATABASE_URL for migration example doesn't work #59

@garethlau

Description

@garethlau

Hey! I found this example from this page. I did as the docs suggested, adding an override to the DATABASE_URL environment variable in package.json. I couldn't get it to work so I tried this example repository and also found that it failed to run the migrations.

I cloned the data-proxy branch and added a .env file with two variables:

DATABASE_URL=prisma://<stuff>
MIGRATE_DATABASE_URL=postgresql://<stuff>

Then I ran yarn run prisma:migrate script and got the following error:

$ DATABASE_URL="$MIGRATE_DATABASE_URL" prisma migrate deploy
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Error: Schema validation error - Error (query-engine-node-api library)
Error code: P1012
error: Error validating datasource `db`: You must provide a nonempty URL. The environment variable `DATABASE_URL` resolved to an empty string.
  -->  schema.prisma:7
   |
 6 |   provider = "postgresql"
 7 |   url      = env("DATABASE_URL")
   |

Validation Error Count: 1
[Context: getConfig]

Prisma CLI Version : 4.4.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions