Prisma migration issue on vercel deployment

Hi Gang,

I'm facing a persistent migration issue with my prisma model in my PostgreSQL database hosted on Railway. Here's a breakdown of the situation:

My original prisma schema model was the following:

model LenderFees {
  id              String        @id @default(uuid())
  lenderProductId String        @unique @default(cuid())
  lender          LenderProduct @relation(fields: [lenderProductId], references: [id], onDelete: Cascade)
  exitFee         String
  lineFee         String
  solicitorFee    String
  valuationFee    String
  otherFee        String


I removed some columns and added new ones on a feature branch
feat/edit-lender-fees

model LenderFees {
  id               String        @id @default(uuid())
  lenderProductId  String        @unique @default(cuid())
  lender           LenderProduct @relation(fields: [lenderProductId], references: [id], onDelete: Cascade)
  exitFeeFlat      String
  lineFeeFlat      String
  solicitorFeeFlat String
  valuationFeeFlat String
  otherFeeFlat     String
  exitFeePercent      String
  lineFeePercent      String
  solicitorFeePercent String
  valuationFeePercent String
  otherFeePercent     String
}


And quickly learnt that dropping columns with existing data had caused a few problems. After creating a migration file by running
prisma migrate dev

I had warnings that were in the migration.sql (which i called 20230925134023_lender_product_fees) but i did not see initially

Issues:

Removing columns with data resulted in warnings upon running
npx prisma migrate dev.

Deploying to Vercel produced an error while running the script

"production:build": "npx prisma generate && npx prisma migrate deploy && next build"


Persistent error:

migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: <https://pris.ly/d/migrate-resolve>
The `20230925134023_lender_product_fees` migration started at 2023-09-25 14:30:12.419795 UTC failed
Error: Command "npm run production:build" exited with 1


Note again, this was all done on a feature branch
feat/edit-lender-fees


So I've abandoned that branch for now and gone to branched off
main
again to add some new feature. This new branch does have the before mentioned migration.sql file
20230925134023_lender_product_fees
but I am still getting issues when deploying in the "Building step" with the same problem mentioned above.

Error: P3009
migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve
The `20230925134023_lender_product_fees` migration started at 2023-09-25 14:30:12.419795 UTC failed
Error: Command "npm run production:build" exited with 1


Would anyone know why a branch that has nothing to do with the schema changes still be affecting the deployment?
Was this page helpful?