Skip to content

Combining re-exported migrations from a different crate #3407

Answered by CommanderStorm
nMessage asked this question in Q&A
Discussion options

You must be logged in to vote

Shure, just call the Migrator (/migrate!() macro) twice with the .set_ignore_missing(true).
Yes, this does leave you with a possible footgun (removing migrations), but that should be fairly straightforeward.

apalis does provide the migrations() method on which you can set this option:

https://github.com/geofmureithi/apalis/blob/353d6f8450e862daa3553cb953a73a15bdd9cea4/packages/apalis-sql/src/postgres.rs#L184

The resulting code would be something like

sqlx::migrate!()
        .set_ignore_missing(true)
        .run(&pool)
        .await
        .expect("unable to run migrations for postgres");;
    PostgresStorage::migrations()
        .set_ignore_missing(true)
        .run(&pool)
        .a…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nMessage
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