Skip to content

How to enable migrations correctly? #3826

Answered by muturgan
muturgan asked this question in Q&A
Discussion options

You must be logged in to vote

After several attempts, I found a solution.
I adding dependencies like this:

sqlx = { version = "0.8.4", default-features = false, features = ["derive", "runtime-tokio", "tls-none", "postgres"] }
sqlx-core = { version = "0.8.4", features = ["migrate"] }
sqlx-postgres = { version = "0.8.4", features = ["migrate", "chrono", "uuid"] }

and I replace a migrate! call with:

use sqlx_core::migrate::Migrator;

let migrator = Migrator::new(Path::new("./migrations")).await?;
migrator.run(&pool).await?;

that works correct and cleanup dependencies.

Replies: 2 comments 2 replies

Comment options

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

Comment options

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

Answer selected by muturgan
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