Fix crash on startup after updating from 1.3.2

This commit is contained in:
jakobkukla 2022-06-15 23:51:57 +02:00
commit 23029b128f
2 changed files with 12 additions and 1 deletions

View file

@ -58,6 +58,7 @@ public class App extends Application {
.addMigrations(JellyDatabase.Migration4) .addMigrations(JellyDatabase.Migration4)
.addMigrations(JellyDatabase.Migration5) .addMigrations(JellyDatabase.Migration5)
.addMigrations(JellyDatabase.Migration6) .addMigrations(JellyDatabase.Migration6)
.addMigrations(JellyDatabase.Migration7)
.build(); .build();
} }

View file

@ -15,7 +15,7 @@ import com.dkanada.gramophone.model.User;
QueueSong.class, QueueSong.class,
User.class User.class
}, },
version = 6, version = 7,
exportSchema = false exportSchema = false
) )
public abstract class JellyDatabase extends RoomDatabase { public abstract class JellyDatabase extends RoomDatabase {
@ -76,4 +76,14 @@ public abstract class JellyDatabase extends RoomDatabase {
+ "FOREIGN KEY (songId) REFERENCES songs(id) ON DELETE CASCADE)"); + "FOREIGN KEY (songId) REFERENCES songs(id) ON DELETE CASCADE)");
} }
}; };
public static final Migration Migration7 = new Migration(6, 7) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL("DELETE FROM queueSongs");
database.execSQL("DELETE FROM songs");
database.execSQL("ALTER TABLE songs ADD COLUMN supportsTranscoding INTEGER NOT NULL");
}
};
} }