Skip to content

Help with Prisma migrations in prod #540

Closed Answered by arpitdalal
arpitdalal asked this question in Q&A
Discussion options

You must be logged in to vote

This is how I fixed it:

TLDR:
Run the app without exec section in litefs.yml file and then re-deploy the app. Remove the problematic prisma migration from the prod db and migration SQL file. Re deploy the app with the exec section in litefs.yml file.

Steps:

  1. comment exec section in litefs.yml
  2. deploy the app
  3. ssh into it
  4. litefs export the db
  5. sftp download the db to the computer to backup
  6. make a copy of this db
  7. remove the last entry (failing entry) from _prisma_migrations table from the copied db
  8. sftp upload the copied db to the app
  9. litefs import this db
  10. remove the problematic prisma-generated migration SQL file from the source code
  11. un-comment exec section in litefs.yml
  12. commit these changes …

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@kentcdodds
Comment options

Comment options

You must be logged in to vote
3 replies
@kentcdodds
Comment options

@arpitdalal
Comment options

@arpitdalal
Comment options

Answer selected by arpitdalal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants