Chris Bitoy
04/14/2022, 8:22 PMschema.prisma file. So I configured my app to using data proxy provided, and used the the provided prisma://.... as DATABASE_URL connection string in my schema.prisma file. However, When I tried migrating the models npx prisma migrate dev - I got this error:
Error: Get config: Schema Parsing P1012
error: Error validating datasource `db`: the URL must start with the protocol `postgresql://` or `postgres://`.
--> schema.prisma:8
|
7 | provider = "postgresql"
8 | url = env("DATABASE_URL")
|
Validation Error Count: 1
How do I fix this?Austin
04/14/2022, 9:45 PMprisma migrate commands.
You can read more here.Chris Bitoy
04/15/2022, 6:20 PMprisma migrate ? I plugged in my database connection string and started my app, but got this error:
error - InvalidDatasourceError: Datasource URL should use prisma:// protocolAustin
04/18/2022, 2:13 PM// package.json
{
...,
"scripts": {
"generate-client": "PRISMA_CLIENT_ENGINE_TYPE='dataproxy' prisma generate",
"migrate": "DATABASE_URL=\"$MIGRATE_DATABASE_URL\" prisma migrate deploy",
...
}
}Chris Bitoy
04/18/2022, 3:59 PMChris Bitoy
04/20/2022, 8:43 PMnpx prisma migrate dev without switching the DATABASE_URL . Does this look right to you?
//package.json
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"postinstall": "prisma generate",
"lint": "next lint",
"generate-client": "PRISMA_CLIENT_ENGINE_TYPE='dataproxy' prisma generate",
"migrate": "DATABASE_URL=\"$MIGRATE_DATABASE_URL\" prisma migrate deploy"
},
//.env
MIGRATE_DATABASE_URL='<prisma://aws-us-east>-...' //these are part of the strings
DATABASE_URL='<postgresql://mentorsuser>:Oluw...' //these are part of the strings
PRISMA_CLIENT_ENGINE_TYPE=dataproxyAustin
04/21/2022, 1:28 PMMIGRATE_DATABASE_URL needs to be your actual Postgres connection string, and the DATABASE_URL will be the Data Proxy connection string.Chris Bitoy
04/21/2022, 9:08 PM