File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -409,23 +409,14 @@ impl Sage {
409409 )
410410 . await ?;
411411
412- let version = Self :: database_version ( & pool) . await ?;
413-
414- if version < 2 {
412+ if let Err ( _error) = sqlx:: migrate!( "../../migrations" ) . run ( & pool) . await {
413+ // TODO: Handle migration error
415414 return Err ( Error :: DatabaseVersionTooOld ) ;
416415 }
417- sqlx:: migrate!( "../../migrations" ) . run ( & pool) . await ?;
418416
419417 Ok ( pool)
420418 }
421419
422- async fn database_version ( pool : & SqlitePool ) -> Result < i32 > {
423- let row: ( i32 , ) = sqlx:: query_as ( "PRAGMA user_version" )
424- . fetch_one ( pool)
425- . await ?;
426- Ok ( row. 0 )
427- }
428-
429420 pub fn wallet_db_path ( & self , fingerprint : u32 ) -> Result < PathBuf > {
430421 let path = self . path . join ( "wallets" ) . join ( fingerprint. to_string ( ) ) ;
431422 fs:: create_dir_all ( & path) ?;
Original file line number Diff line number Diff line change 11PRAGMA journal_mode = WAL;
22PRAGMA foreign_keys = ON ;
3- PRAGMA user_version = 2 ;
You can’t perform that action at this time.
0 commit comments