From f657d37cbd28ca51f1f09a2f94e8908404f82316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Szczodrzy=C5=84ski?= Date: Fri, 10 Jan 2020 22:23:14 +0100 Subject: [PATCH] [DB/Timetable] Fix migration fixing wrong primary key columns. --- app/src/main/java/pl/szczodrzynski/edziennik/data/db/AppDb.java | 2 ++ 1 file changed, 2 insertions(+) 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 80aba0be..e6a6731a 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 @@ -986,6 +986,8 @@ public abstract class AppDb extends RoomDatabase { database.execSQL("CREATE TABLE timetable (profileId INTEGER NOT NULL,id INTEGER NOT NULL,type INTEGER NOT NULL,date TEXT DEFAULT NULL,lessonNumber INTEGER DEFAULT NULL,startTime TEXT DEFAULT NULL,endTime TEXT DEFAULT NULL,subjectId INTEGER DEFAULT NULL,teacherId INTEGER DEFAULT NULL,teamId INTEGER DEFAULT NULL,classroom TEXT DEFAULT NULL,oldDate TEXT DEFAULT NULL,oldLessonNumber INTEGER DEFAULT NULL,oldStartTime TEXT DEFAULT NULL,oldEndTime TEXT DEFAULT NULL,oldSubjectId INTEGER DEFAULT NULL,oldTeacherId INTEGER DEFAULT NULL,oldTeamId INTEGER DEFAULT NULL,oldClassroom TEXT DEFAULT NULL,PRIMARY KEY(profileId, id));"); database.execSQL("INSERT INTO timetable SELECT * FROM _timetable;"); database.execSQL("DROP TABLE _timetable;"); + database.execSQL("CREATE INDEX index_lessons_profileId_type_date ON timetable (profileId, type, date);"); + database.execSQL("CREATE INDEX index_lessons_profileId_type_oldDate ON timetable (profileId, type, oldDate);"); } };