add a tested fix for the database changes
This commit is contained in:
parent
1b3a85f40e
commit
dddb7edf6e
2 changed files with 5 additions and 1 deletions
|
|
@ -58,8 +58,10 @@ public abstract class JellyDatabase extends RoomDatabase {
|
||||||
public static final Migration Migration5 = new Migration(4, 5) {
|
public static final Migration Migration5 = new Migration(4, 5) {
|
||||||
@Override
|
@Override
|
||||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||||
|
database.execSQL("ALTER TABLE songs ADD COLUMN cache INTEGER NOT NULL DEFAULT 1");
|
||||||
|
|
||||||
database.execSQL("CREATE TABLE cache (id TEXT NOT NULL PRIMARY KEY,"
|
database.execSQL("CREATE TABLE cache (id TEXT NOT NULL PRIMARY KEY,"
|
||||||
+ "cache INTEGER NOT NULL DEFAULT '1')");
|
+ "cache INTEGER NOT NULL DEFAULT 1)");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.room.ColumnInfo;
|
||||||
import androidx.room.Entity;
|
import androidx.room.Entity;
|
||||||
import androidx.room.PrimaryKey;
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
|
|
@ -46,6 +47,7 @@ public class Song implements Parcelable {
|
||||||
public int bitDepth;
|
public int bitDepth;
|
||||||
public int channels;
|
public int channels;
|
||||||
|
|
||||||
|
@ColumnInfo(defaultValue = "1")
|
||||||
public boolean cache;
|
public boolean cache;
|
||||||
|
|
||||||
public Song() {
|
public Song() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue