From 931d09d0b0cfbb7d11b86e7f13eccdfa8aef9a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Wed, 9 Oct 2019 18:50:17 +0200 Subject: [PATCH] Add database migration (unset last full sync) --- .../pl/szczodrzynski/edziennik/data/db/AppDb.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/AppDb.java b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/AppDb.java index 05ac2fb1..1481b8e1 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/AppDb.java +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/AppDb.java @@ -81,7 +81,7 @@ import android.content.Context; Message.class, MessageRecipient.class, DebugLog.class, - Metadata.class}, version = 54) + Metadata.class}, version = 55) @TypeConverters({ ConverterTime.class, ConverterDate.class, @@ -558,6 +558,12 @@ public abstract class AppDb extends RoomDatabase { database.execSQL("ALTER TABLE teacherAbsence ADD teacherAbsenceTimeTo TEXT DEFAULT NULL"); } }; + private static final Migration MIGRATION_54_55 = new Migration(54, 55) { + @Override + public void migrate(@NonNull SupportSQLiteDatabase database) { + database.execSQL("UPDATE profiles SET lastFullSync = 0"); + } + }; public static AppDb getDatabase(final Context context) { @@ -609,7 +615,8 @@ public abstract class AppDb extends RoomDatabase { MIGRATION_50_51, MIGRATION_51_52, MIGRATION_52_53, - MIGRATION_53_54 + MIGRATION_53_54, + MIGRATION_54_55 ) .allowMainThreadQueries() //.fallbackToDestructiveMigration()