How to Solve the Error Encountered while running Prisma Migrate on a Cloud Server

Resolve Prisma-to-Cloud Database Migration Issue

Screenshot from 2021-10-23 06-40-40.png

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:

  1. Set up a local DB. I am using PostgreSQL
  2. Change your prisma .env file to local DB
  3. Delete prisma/migrations folder
  4. Run npx prisma migrate dev --name my_deploy to start a new migration
  5. Change your prisma .env file back to the development DB
  6. Apply the migration by passing the migration folder name generated in step 4 by running npx prisma migrate resolve --applied my_deploy --preview-feature