Merge pull request #215 from jakobkukla/fix-migration
Fix crash on startup after updating from 1.3.2
This commit is contained in:
commit
c05fe7fd7e
2 changed files with 12 additions and 1 deletions
|
|
@ -58,6 +58,7 @@ public class App extends Application {
|
|||
.addMigrations(JellyDatabase.Migration4)
|
||||
.addMigrations(JellyDatabase.Migration5)
|
||||
.addMigrations(JellyDatabase.Migration6)
|
||||
.addMigrations(JellyDatabase.Migration7)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import com.dkanada.gramophone.model.User;
|
|||
QueueSong.class,
|
||||
User.class
|
||||
},
|
||||
version = 6,
|
||||
version = 7,
|
||||
exportSchema = false
|
||||
)
|
||||
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)");
|
||||
}
|
||||
};
|
||||
|
||||
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");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue