Automatically clear old download log entries on upgrade (#6370)

This commit is contained in:
ByteHamster 2023-03-11 17:44:21 +01:00 committed by GitHub
parent 835f007b67
commit 86c11584b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -1477,6 +1477,9 @@ public class PodDBAdapter {
public void onUpgrade(final SQLiteDatabase db, final int oldVersion, final int newVersion) {
Log.w("DBAdapter", "Upgrading from version " + oldVersion + " to " + newVersion + ".");
DBUpgrader.upgrade(db, oldVersion, newVersion);
db.execSQL("DELETE FROM " + PodDBAdapter.TABLE_NAME_DOWNLOAD_LOG + " WHERE "
+ PodDBAdapter.KEY_COMPLETION_DATE + "<" + (System.currentTimeMillis() - 7L * 24L * 3600L * 1000L));
}
}
}