Skip to content

Commit

Permalink
fixup syncstorage-mysql/src/pool.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
tommie committed Dec 28, 2024
1 parent ce67fa2 commit b684206
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions syncstorage-mysql/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!();
/// Mysql DDL statements implicitly commit which could disrupt MysqlPool's
/// begin_test_transaction during tests. So this runs on its own separate conn.
fn run_embedded_migrations(database_url: &str) -> DbResult<()> {
let mut conn = MysqlConnection::establish(database_url)?;
let conn = MysqlConnection::establish(database_url)?;

// This conn2 charade is to make mut-ness the same for both cases.
#[cfg(debug_assertions)]
// XXX: this doesn't show the DDL statements
// https://github.com/shssoichiro/diesel-logger/issues/1
LoggingConnection::new(conn).run_pending_migrations(MIGRATIONS)?;
let mut conn2 = LoggingConnection::new(conn);
#[cfg(not(debug_assertions))]
conn.run_pending_migrations(MIGRATIONS)?;
let mut conn2 = conn;

conn2.run_pending_migrations(MIGRATIONS)?;
Ok(())
}

Expand Down

0 comments on commit b684206

Please sign in to comment.