@@ -11,13 +11,13 @@ diesel_migrations::embed_migrations!("./migrations");
1111pub struct Opts ;
1212
1313pub fn run ( _opts : Opts ) -> Result < ( ) , Error > {
14- let db_config = crate :: config:: DatabasePools :: full_from_environment ( ) ;
14+ let config = crate :: config:: Server :: default ( ) ;
1515
1616 // TODO: Refactor logic so that we can also check things from App::new() here.
1717 // If the app will panic due to bad configuration, it is better to error in the release phase
1818 // to avoid launching dynos that will fail.
1919
20- if db_config . are_all_read_only ( ) {
20+ if config . db . are_all_read_only ( ) {
2121 // TODO: Check `any_pending_migrations()` with a read-only connection and error if true.
2222 // It looks like this requires changes upstream to make this pub in `migration_macros`.
2323
@@ -29,13 +29,14 @@ pub fn run(_opts: Opts) -> Result<(), Error> {
2929 return Ok ( ( ) ) ;
3030 }
3131
32- println ! ( "==> migrating the database" ) ;
3332 // The primary is online, access directly via `DATABASE_URL`.
34- let conn = crate :: db:: connect_now ( ) ?;
33+ let conn = crate :: db:: connect_now ( & config) ?;
34+
35+ println ! ( "==> migrating the database" ) ;
3536 embedded_migrations:: run_with_output ( & conn, & mut std:: io:: stdout ( ) ) ?;
3637
3738 println ! ( "==> synchronizing crate categories" ) ;
38- crate :: boot:: categories:: sync ( CATEGORIES_TOML ) . unwrap ( ) ;
39+ crate :: boot:: categories:: sync_with_connection ( CATEGORIES_TOML , & conn ) . unwrap ( ) ;
3940
4041 Ok ( ( ) )
4142}
0 commit comments