Run the db migrations not only in trace log level
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Fix a bug where the database migrations were only triggered when the
application was started in the `trace` logging level.
This commit is contained in:
finga 2023-02-07 14:19:22 +01:00
parent e59fa30b78
commit 869229c30e

View file

@ -108,10 +108,12 @@ async fn main() -> Result<()> {
Config::init(args.config)?; Config::init(args.config)?;
let mut db_pool = get_connection_pool(Config::get())?; let mut db_pool = get_connection_pool(Config::get())?;
trace!(migrations = ?db_pool let mut db_connection = db_pool.get()?;
.get()? let migrations = db_connection
.run_pending_migrations(MIGRATIONS) .run_pending_migrations(MIGRATIONS)
.map_err(|e| anyhow!(e)), "running database migrations"); .map_err(|e| anyhow!(e))?;
trace!(?migrations, "applied database");
let reminder = std::thread::spawn(move || -> Result<(), Error> { let reminder = std::thread::spawn(move || -> Result<(), Error> {
let mailer = SmtpTransport::unencrypted_localhost(); let mailer = SmtpTransport::unencrypted_localhost();