update room version and fix annotation error
This commit is contained in:
parent
5ae74bf222
commit
3fee37ac19
4 changed files with 24 additions and 9 deletions
|
|
@ -89,8 +89,8 @@ dependencies {
|
||||||
|
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||||
|
|
||||||
annotationProcessor 'androidx.room:room-compiler:2.2.6'
|
annotationProcessor 'androidx.room:room-compiler:2.3.0'
|
||||||
implementation 'androidx.room:room-runtime:2.2.6'
|
implementation 'androidx.room:room-runtime:2.3.0'
|
||||||
|
|
||||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
|
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
|
||||||
implementation 'com.github.bumptech.glide:annotations:4.11.0'
|
implementation 'com.github.bumptech.glide:annotations:4.11.0'
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ public class App extends Application {
|
||||||
.addMigrations(JellyDatabase.Migration3)
|
.addMigrations(JellyDatabase.Migration3)
|
||||||
.addMigrations(JellyDatabase.Migration4)
|
.addMigrations(JellyDatabase.Migration4)
|
||||||
.addMigrations(JellyDatabase.Migration5)
|
.addMigrations(JellyDatabase.Migration5)
|
||||||
|
.addMigrations(JellyDatabase.Migration6)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import com.dkanada.gramophone.model.User;
|
||||||
QueueSong.class,
|
QueueSong.class,
|
||||||
User.class
|
User.class
|
||||||
},
|
},
|
||||||
version = 5,
|
version = 6,
|
||||||
exportSchema = false
|
exportSchema = false
|
||||||
)
|
)
|
||||||
public abstract class JellyDatabase extends RoomDatabase {
|
public abstract class JellyDatabase extends RoomDatabase {
|
||||||
|
|
@ -64,4 +64,16 @@ public abstract class JellyDatabase extends RoomDatabase {
|
||||||
+ "cache INTEGER NOT NULL DEFAULT 1)");
|
+ "cache INTEGER NOT NULL DEFAULT 1)");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static final Migration Migration6 = new Migration(5, 6) {
|
||||||
|
@Override
|
||||||
|
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||||
|
database.execSQL("DROP TABLE queueSongs");
|
||||||
|
|
||||||
|
database.execSQL("CREATE TABLE queueSongs ('index' INTEGER NOT NULL,"
|
||||||
|
+ "queue INTEGER NOT NULL, songId TEXT,"
|
||||||
|
+ "PRIMARY KEY ('index', queue),"
|
||||||
|
+ "FOREIGN KEY (songId) REFERENCES songs(id) ON DELETE CASCADE)");
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,14 @@ import com.dkanada.gramophone.model.Song;
|
||||||
primaryKeys = {
|
primaryKeys = {
|
||||||
"index",
|
"index",
|
||||||
"queue"
|
"queue"
|
||||||
|
},
|
||||||
|
foreignKeys = {
|
||||||
|
@ForeignKey(
|
||||||
|
entity = Song.class,
|
||||||
|
parentColumns = {"id"},
|
||||||
|
childColumns = {"songId"},
|
||||||
|
onDelete = ForeignKey.CASCADE
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
public class QueueSong {
|
public class QueueSong {
|
||||||
|
|
@ -17,12 +25,6 @@ public class QueueSong {
|
||||||
|
|
||||||
public int queue;
|
public int queue;
|
||||||
|
|
||||||
@ForeignKey(
|
|
||||||
entity = Song.class,
|
|
||||||
parentColumns = {"id"},
|
|
||||||
childColumns = {"songId"},
|
|
||||||
onDelete = ForeignKey.CASCADE
|
|
||||||
)
|
|
||||||
public String songId;
|
public String songId;
|
||||||
|
|
||||||
public QueueSong(String songId, int index, int queue) {
|
public QueueSong(String songId, int index, int queue) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue