Skip to content

Set migration stage manually / syncing migration state between dev and prod #4360

Answered by weiznich
jafioti asked this question in Q&A
Discussion options

You must be logged in to vote

The problem is, my prod db is still 5 migrations behind, but my schema.rs is up to the latest migration. How would you recommend syncing these two? I can't run the reverts because the changes in the DB of the most recent migrations don't exist in prod to be undone.

The correct way to sync those two states is to apply the missing 5 migrations to your production database before deploying the new version. This can be done via diesel-cli or via the embed_migration!() macro and then running migrations on startup. Depending on your uptime requirements you might do some fancy steps here, or just shut down the old applications, apply the migrations and start the new application.

Is there some …

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@jafioti
Comment options

@weiznich
Comment options

@jafioti
Comment options

@jafioti
Comment options

@weiznich
Comment options

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