How to Solve the Error Encountered while running Prisma Migrate on a Cloud Server
Resolve Prisma-to-Cloud Database Migration Issue
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "dbhostsite.com:6543"
Error: Database error
Error querying the database: db error: ERROR: unexpected response from login query
0: sql_migration_connector::flavour::postgres::sql_schema_from_migration_history
at migration-engine/connectors/sql-migration-connector/src/flavour/postgres.rs:375
1: migration_core::api::DevDiagnostic
at migration-engine/core/src/api.rs:89
According to Nikolas Burk, you can also run
npx prisma db push
instead of the npx prisma migrate dev
command.
Alternatively, according to Paul Liu:
- Set up a local DB. I am using PostgreSQL
- Change your prisma
.env
file to local DB - Delete
prisma/migrations
folder - Run
npx prisma migrate dev --name my_deploy
to start a new migration - Change your prisma
.env
file back to the development DB - Apply the migration by passing the migration folder name generated in step 4 by running
npx prisma migrate resolve --applied my_deploy --preview-feature