Added log filtering

This commit is contained in:
M66B
2021-08-16 09:36:23 +02:00
parent 40ea1c3cb9
commit acee2a5014
10 changed files with 158 additions and 89 deletions

View File

@@ -2104,7 +2104,7 @@ public abstract class DB extends RoomDatabase {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("ALTER TABLE `log` ADD COLUMN `type` INTEGER NOT NULL DEFAULT " + EntityLog.LOG_GENERAL);
db.execSQL("ALTER TABLE `log` ADD COLUMN `type` INTEGER NOT NULL DEFAULT " + EntityLog.Type.General.ordinal());
}
}).addMigrations(new Migration(998, 999) {
@Override
@@ -2234,6 +2234,15 @@ public abstract class DB extends RoomDatabase {
}
return result.toArray(new Address[0]);
}
@TypeConverter
public static EntityLog.Type toLogType(int ordinal) {
return EntityLog.Type.values()[ordinal];
}
@TypeConverter
public static int fromLogType(EntityLog.Type type) {
return type.ordinal();
}
}
}