File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -55,18 +55,25 @@ async function createBackupFromPrevDB() {
5555 const backupPath = path . normalize (
5656 path . join ( app . getPath ( "userData" ) , "Local Storage" , "backup_leveldb.json" )
5757 ) ;
58+ const dbBackupPath = path . normalize (
59+ path . join ( app . getPath ( "userData" ) , "Local Storage" , "leveldb_backup" )
60+ ) ;
5861
5962 if ( ! fs . existsSync ( dbPath ) ) {
6063 log . error ( "LevelDB database not found at path. Code:EM01" , dbPath ) ;
6164 return ;
6265 }
6366
67+ // Copy the database to not lose original data
68+ fs . cpSync ( dbPath , dbBackupPath , { recursive : true } ) ;
69+
70+
6471 if ( fs . existsSync ( backupPath ) ) {
6572 log . info ( "Backup file already exists. Skipping migration." ) ;
6673 return ;
6774 }
6875
69- const db = new Level ( dbPath ) ;
76+ const db = new Level ( dbBackupPath ) ;
7077
7178 // Retry logic for opening the database
7279 const maxRetries = 3 ;
You can’t perform that action at this time.
0 commit comments