get rid of mtime=0

Setting mtime=0 was done by older releases and is always wrong, it should be at least '1'
Also fixes triggerFullMediaScan() to ditch the correct values ;-)
This commit is contained in:
Adrian Ulrich 2017-02-11 15:12:14 +01:00
parent 4c59fc2486
commit 7d9025a967
2 changed files with 8 additions and 2 deletions

View File

@ -35,7 +35,7 @@ public class MediaLibraryBackend extends SQLiteOpenHelper {
/**
* The database version we are using
*/
private static final int DATABASE_VERSION = 20170120;
private static final int DATABASE_VERSION = 20170211;
/**
* on-disk file to store the database
*/

View File

@ -234,6 +234,12 @@ public class MediaSchema {
dbh.execSQL(DATABASE_CREATE_PREFERENCES);
triggerFullMediaScan(dbh);
}
if (oldVersion < 20170211) {
// older versions of triggerFullMediaScan did this by mistake
dbh.execSQL("UPDATE songs SET mtime=1 WHERE mtime=0");
}
}
/**
@ -245,7 +251,7 @@ public class MediaSchema {
private static void triggerFullMediaScan(SQLiteDatabase dbh) {
dbh.execSQL("UPDATE "+MediaLibrary.TABLE_SONGS+" SET "+MediaLibrary.SongColumns.MTIME+"=1");
// wipes non-bools only - not nice but good enough for now
dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_PREFERENCES+" WHERE "+MediaLibrary.PreferenceColumns.VALUE+" < 2");
dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_PREFERENCES+" WHERE "+MediaLibrary.PreferenceColumns.VALUE+" > 1");
}
}