File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ use rorm_db::sql::drop_table::DropTable;
77use rorm_db:: sql:: insert:: Insert ;
88use rorm_db:: sql:: value:: Value ;
99use rorm_db:: sql:: DBImpl ;
10- use rorm_db:: transaction:: Transaction ;
10+ use rorm_db:: transaction:: { Transaction , TransactionError } ;
1111use rorm_db:: Database ;
1212use rorm_declaration:: migration:: { Migration , Operation } ;
1313use thiserror:: Error ;
@@ -59,8 +59,11 @@ pub async fn apply_migration(
5959 location : ApplyMigrationErrorLocation :: UpdateLastMigration ,
6060 } ) ?;
6161
62- tx. commit ( ) . await . map_err ( |error| ApplyMigrationError {
63- error,
62+ tx. commit ( ) . await . map_err ( |x| ApplyMigrationError {
63+ error : match x {
64+ TransactionError :: Database ( x) => x,
65+ TransactionError :: Hook ( _) => unreachable ! ( "rorm-cli does not use hooks" ) ,
66+ } ,
6467 location : ApplyMigrationErrorLocation :: CommitTransaction ,
6568 } ) ?;
6669
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ use std::path::Path;
44use anyhow:: { anyhow, Context } ;
55use rorm_db:: executor:: { Executor , Nothing , Optional } ;
66use rorm_db:: sql:: create_table:: CreateTable ;
7+ use rorm_db:: transaction:: TransactionError ;
78use rorm_db:: Database ;
89use rorm_declaration:: config:: DatabaseConfig ;
910use rorm_declaration:: imr:: { Annotation , DbType } ;
@@ -101,6 +102,10 @@ pub async fn run_migrate_custom(
101102
102103 tx. commit ( )
103104 . await
105+ . map_err ( |x| match x {
106+ TransactionError :: Database ( x) => x,
107+ TransactionError :: Hook ( _) => unreachable ! ( "rorm-cli does not use hooks" ) ,
108+ } )
104109 . with_context ( || "Couldn't create internal last migration table" ) ?;
105110
106111 let last_migration: Option < i32 > = pool
You can’t perform that action at this time.
0 commit comments