@@ -895,13 +895,24 @@ private static <T> boolean copyDao(AbstractDao<T, ?> from, AbstractDao<T, ?> to)
895895 }
896896 } catch (IOException e ) {
897897 return false ;
898+ } catch (SQLiteException e ) {
899+ Log .e (TAG , "Failed to copy DAO data" , e );
900+ return false ;
898901 }
899902 return true ;
900903 }
901904
902905 public static synchronized boolean exportDB (Context context , File file ) {
903906 final String ehExportName = "eh.export.db" ;
904907
908+ // Ensure source database has ARCHIVE_URI column
909+ try {
910+ sDaoSession .getDatabase ().execSQL ("ALTER TABLE \" DOWNLOADS\" ADD COLUMN \" ARCHIVE_URI\" TEXT" );
911+ } catch (Exception e ) {
912+ // Column might already exist, ignore the error
913+ Log .d (TAG , "ARCHIVE_URI column already exists or failed to add" , e );
914+ }
915+
905916 // Delete old export db
906917 context .deleteDatabase (ehExportName );
907918
@@ -912,7 +923,7 @@ public static synchronized boolean exportDB(Context context, File file) {
912923 try (SQLiteDatabase db = helper .getWritableDatabase ()) {
913924 DaoMaster daoMaster = new DaoMaster (db );
914925 DaoSession exportSession = daoMaster .newSession ();
915- if (!copyDao (sDaoSession .getDownloadsDao (), exportSession .getDownloadsDao ()))
926+ if (! copyDao (sDaoSession .getDownloadsDao (), exportSession .getDownloadsDao ()))
916927 return false ;
917928 if (!copyDao (sDaoSession .getDownloadLabelDao (), exportSession .getDownloadLabelDao ()))
918929 return false ;
0 commit comments