File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -872,18 +872,23 @@ impl SignerDb {
872
872
) ;
873
873
}
874
874
875
- if current_db_version < Self :: SCHEMA_VERSION {
876
- sql_tx. rollback ( ) ?;
877
- return Err ( DBError :: Other ( format ! (
878
- "Database migration incomplete. Current version: {}, Target application version: {}" ,
879
- current_db_version, Self :: SCHEMA_VERSION
880
- ) ) ) ;
881
- } else if current_db_version > Self :: SCHEMA_VERSION {
882
- sql_tx. rollback ( ) ?;
883
- return Err ( DBError :: Other ( format ! (
884
- "Database schema is newer than SCHEMA_VERSION. SCHEMA_VERSION = {}, current_db_version = {}. Did you forget to update SCHEMA_VERSION?" ,
885
- Self :: SCHEMA_VERSION , current_db_version
886
- ) ) ) ;
875
+ match current_db_version. cmp ( & Self :: SCHEMA_VERSION ) {
876
+ std:: cmp:: Ordering :: Less => {
877
+ sql_tx. rollback ( ) ?;
878
+ return Err ( DBError :: Other ( format ! (
879
+ "Database migration incomplete. Current version: {}, SCHEMA_VERSION: {}" ,
880
+ current_db_version,
881
+ Self :: SCHEMA_VERSION
882
+ ) ) ) ;
883
+ }
884
+ std:: cmp:: Ordering :: Greater => {
885
+ sql_tx. rollback ( ) ?;
886
+ return Err ( DBError :: Other ( format ! (
887
+ "Database schema is newer than SCHEMA_VERSION. SCHEMA_VERSION = {}, Current version = {}. Did you forget to update SCHEMA_VERSION?" ,
888
+ Self :: SCHEMA_VERSION , current_db_version
889
+ ) ) ) ;
890
+ }
891
+ std:: cmp:: Ordering :: Equal => { }
887
892
}
888
893
889
894
sql_tx. commit ( ) ?;
You can’t perform that action at this time.
0 commit comments