Skip to content

Commit

Permalink
Better logging of migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Eragonfr committed Mar 5, 2024
1 parent e2b8563 commit c8c1458
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tokenserver-db-mysql/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ embed_migrations!();
/// begin_test_transaction during tests. So this runs on its own separate conn.
pub fn run_embedded_migrations(database_url: &str) -> DbResult<()> {
let conn = MysqlConnection::establish(database_url)?;

#[cfg(debug_assertions)]
// XXX: this doesn't show the DDL statements
// https://github.com/shssoichiro/diesel-logger/issues/1
embedded_migrations::run(&LoggingConnection::new(conn))?;

#[cfg(not(debug_assertions))]
embedded_migrations::run(&conn)?;
Ok(())
}
5 changes: 5 additions & 0 deletions tokenserver-db-sqlite/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ embed_migrations!();
pub fn run_embedded_migrations(database_url: &str) -> DbResult<()> {
let conn = SqliteConnection::establish(database_url)?;

#[cfg(debug_assertions)]
// XXX: this doesn't show the DDL statements
// https://github.com/shssoichiro/diesel-logger/issues/1
embedded_migrations::run(&LoggingConnection::new(conn))?;
#[cfg(not(debug_assertions))]
embedded_migrations::run(&conn)?;

Ok(())
}

0 comments on commit c8c1458

Please sign in to comment.