Combining re-exported migrations from a different crate #3407
-
I have some database migrations from apalis and a internal crate (called Store). or am I attempting something very silly? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Shure, just call the
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)
.await
.expect("unable to run migrations2 for postgres"); An alternative would be to build a MargedMigrator which takes multiple |
Beta Was this translation helpful? Give feedback.
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 themigrations()
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