File tree Expand file tree Collapse file tree 4 files changed +15
-3
lines changed Expand file tree Collapse file tree 4 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ pub enum MigrateError {
66 #[ error( "while executing migrations: {0}" ) ]
77 Execute ( #[ from] Error ) ,
88
9+ #[ error( "while executing migration {1}: {0}" ) ]
10+ ExecuteMigration ( #[ source] Error , i64 ) ,
11+
912 #[ error( "while resolving migrations: {0}" ) ]
1013 Source ( #[ source] BoxDynError ) ,
1114
Original file line number Diff line number Diff line change @@ -199,7 +199,10 @@ CREATE TABLE IF NOT EXISTS _sqlx_migrations (
199199 . execute ( & mut * tx)
200200 . await ?;
201201
202- let _ = tx. execute ( & * migration. sql ) . await ?;
202+ let _ = tx
203+ . execute ( & * migration. sql )
204+ . await
205+ . map_err ( |e| MigrateError :: ExecuteMigration ( e, migration. version ) ) ?;
203206
204207 // language=MySQL
205208 let _ = query (
Original file line number Diff line number Diff line change @@ -216,7 +216,10 @@ CREATE TABLE IF NOT EXISTS _sqlx_migrations (
216216 // The `execution_time` however can only be measured for the whole transaction. This value _only_ exists for
217217 // data lineage and debugging reasons, so it is not super important if it is lost. So we initialize it to -1
218218 // and update it once the actual transaction completed.
219- let _ = tx. execute ( & * migration. sql ) . await ?;
219+ let _ = tx
220+ . execute ( & * migration. sql )
221+ . await
222+ . map_err ( |e| MigrateError :: ExecuteMigration ( e, migration. version ) ) ?;
220223
221224 // language=SQL
222225 let _ = query (
Original file line number Diff line number Diff line change @@ -142,7 +142,10 @@ CREATE TABLE IF NOT EXISTS _sqlx_migrations (
142142 // The `execution_time` however can only be measured for the whole transaction. This value _only_ exists for
143143 // data lineage and debugging reasons, so it is not super important if it is lost. So we initialize it to -1
144144 // and update it once the actual transaction completed.
145- let _ = tx. execute ( & * migration. sql ) . await ?;
145+ let _ = tx
146+ . execute ( & * migration. sql )
147+ . await
148+ . map_err ( |e| MigrateError :: ExecuteMigration ( e, migration. version ) ) ?;
146149
147150 // language=SQL
148151 let _ = query (
You can’t perform that action at this time.
0 commit comments