Room - Added schema export directory

This commit is contained in:
CappielloAntonio 2021-09-04 15:21:36 +02:00
parent 11c7d3fa73
commit fc5876829c
3 changed files with 17 additions and 4 deletions

View file

@ -13,6 +13,12 @@ android {
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}
buildTypes {
@ -44,7 +50,7 @@ dependencies {
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.room:room-runtime:2.3.0"
implementation "androidx.room:room-runtime:2.4.0-alpha04"
implementation "androidx.cardview:cardview:1.0.0"
// Android Material
@ -62,7 +68,7 @@ dependencies {
implementation 'com.google.android.exoplayer:exoplayer:2.12.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
annotationProcessor "androidx.room:room-compiler:2.3.0"
annotationProcessor "androidx.room:room-compiler:2.4.0-alpha04"
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'

View file

@ -1,7 +1,9 @@
package com.cappielloantonio.play.database;
import android.annotation.SuppressLint;
import android.content.Context;
import androidx.room.AutoMigration;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
@ -15,7 +17,12 @@ import com.cappielloantonio.play.model.Queue;
import com.cappielloantonio.play.model.RecentSearch;
import com.cappielloantonio.play.model.Server;
@Database(entities = {Queue.class, Server.class, RecentSearch.class, Download.class}, version = 23, exportSchema = false)
@SuppressLint("RestrictedApi")
@Database(
version = 23,
entities = {Queue.class, Server.class, RecentSearch.class, Download.class}
// autoMigrations = { @AutoMigration(from = 23, to = 24) }
)
public abstract class AppDatabase extends RoomDatabase {
private static final String TAG = "AppDatabase";

View file

@ -30,7 +30,7 @@ public interface DownloadDao {
@Query("SELECT * FROM download WHERE server=:server AND artistId=:artistId")
LiveData<List<Download>> getAllFromArtist(String server, String artistId);
@Query("SELECT * FROM download WHERE server=:server AND albumId=:albumId")
@Query("SELECT * FROM download WHERE server=:server AND albumId=:albumId ORDER BY trackNumber ASC")
LiveData<List<Download>> getAllFromAlbum(String server, String albumId);
@Query("SELECT * FROM download WHERE server=:server AND playlistId=:playlistId")