File tree 4 files changed +15
-3
lines changed
4 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ pub enum MigrateError {
6
6
#[ error( "while executing migrations: {0}" ) ]
7
7
Execute ( #[ from] Error ) ,
8
8
9
+ #[ error( "while executing migration {1}: {0}" ) ]
10
+ ExecuteMigration ( #[ source] Error , i64 ) ,
11
+
9
12
#[ error( "while resolving migrations: {0}" ) ]
10
13
Source ( #[ source] BoxDynError ) ,
11
14
Original file line number Diff line number Diff line change @@ -199,7 +199,10 @@ CREATE TABLE IF NOT EXISTS _sqlx_migrations (
199
199
. execute ( & mut * tx)
200
200
. await ?;
201
201
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 ) ) ?;
203
206
204
207
// language=MySQL
205
208
let _ = query (
Original file line number Diff line number Diff line change @@ -216,7 +216,10 @@ CREATE TABLE IF NOT EXISTS _sqlx_migrations (
216
216
// The `execution_time` however can only be measured for the whole transaction. This value _only_ exists for
217
217
// data lineage and debugging reasons, so it is not super important if it is lost. So we initialize it to -1
218
218
// 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 ) ) ?;
220
223
221
224
// language=SQL
222
225
let _ = query (
Original file line number Diff line number Diff line change @@ -142,7 +142,10 @@ CREATE TABLE IF NOT EXISTS _sqlx_migrations (
142
142
// The `execution_time` however can only be measured for the whole transaction. This value _only_ exists for
143
143
// data lineage and debugging reasons, so it is not super important if it is lost. So we initialize it to -1
144
144
// 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 ) ) ?;
146
149
147
150
// language=SQL
148
151
let _ = query (
You can’t perform that action at this time.
0 commit comments