Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sqlx-core/src/migrate/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ pub enum MigrateError {
#[error("while executing migrations: {0}")]
Execute(#[from] Error),

#[error("while executing migration {1}: {0}")]
ExecuteMigration(#[source] Error, i64),

#[error("while resolving migrations: {0}")]
Source(#[source] BoxDynError),

Expand Down
5 changes: 4 additions & 1 deletion sqlx-mysql/src/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ CREATE TABLE IF NOT EXISTS _sqlx_migrations (
.execute(&mut *tx)
.await?;

let _ = tx.execute(&*migration.sql).await?;
let _ = tx
.execute(&*migration.sql)
.await
.map_err(|e| MigrateError::ExecuteMigration(e, migration.version))?;

// language=MySQL
let _ = query(
Expand Down
5 changes: 4 additions & 1 deletion sqlx-postgres/src/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ CREATE TABLE IF NOT EXISTS _sqlx_migrations (
// The `execution_time` however can only be measured for the whole transaction. This value _only_ exists for
// data lineage and debugging reasons, so it is not super important if it is lost. So we initialize it to -1
// and update it once the actual transaction completed.
let _ = tx.execute(&*migration.sql).await?;
let _ = tx
.execute(&*migration.sql)
.await
.map_err(|e| MigrateError::ExecuteMigration(e, migration.version))?;

// language=SQL
let _ = query(
Expand Down
5 changes: 4 additions & 1 deletion sqlx-sqlite/src/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ CREATE TABLE IF NOT EXISTS _sqlx_migrations (
// The `execution_time` however can only be measured for the whole transaction. This value _only_ exists for
// data lineage and debugging reasons, so it is not super important if it is lost. So we initialize it to -1
// and update it once the actual transaction completed.
let _ = tx.execute(&*migration.sql).await?;
let _ = tx
.execute(&*migration.sql)
.await
.map_err(|e| MigrateError::ExecuteMigration(e, migration.version))?;

// language=SQL
let _ = query(
Expand Down