mirror of
https://github.com/CappielloAntonio/tempo.git
synced 2026-01-31 22:53:37 +00:00
Changed the order of deletion and saving of items at the time of synchronization
This commit is contained in:
@@ -29,7 +29,7 @@ import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.model.SongArtistCross;
|
||||
import com.cappielloantonio.play.model.SongGenreCross;
|
||||
|
||||
@Database(entities = {Album.class, Artist.class, Genre.class, Playlist.class, Song.class, RecentSearch.class, SongGenreCross.class, Queue.class, AlbumArtistCross.class, SongArtistCross.class, PlaylistSongCross.class}, version = 12, exportSchema = false)
|
||||
@Database(entities = {Album.class, Artist.class, Genre.class, Playlist.class, Song.class, RecentSearch.class, SongGenreCross.class, Queue.class, AlbumArtistCross.class, SongArtistCross.class, PlaylistSongCross.class}, version = 13, exportSchema = false)
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
private static final String TAG = "AppDatabase";
|
||||
private final static String DB_NAME = "play_db";
|
||||
@@ -38,7 +38,7 @@ public abstract class AppDatabase extends RoomDatabase {
|
||||
public static synchronized AppDatabase getInstance(Context context) {
|
||||
|
||||
if (instance == null && context != null) {
|
||||
instance = Room.databaseBuilder(context.getApplicationContext(), AppDatabase.class, DB_NAME)
|
||||
instance = Room.databaseBuilder(context, AppDatabase.class, DB_NAME)
|
||||
.fallbackToDestructiveMigration()
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -17,9 +17,6 @@ public interface PlaylistSongCrossDao {
|
||||
@Query("SELECT * FROM playlist_song_cross")
|
||||
LiveData<List<PlaylistSongCross>> getAll();
|
||||
|
||||
@Query("SELECT EXISTS(SELECT * FROM playlist_song_cross WHERE id = :id)")
|
||||
boolean exist(String id);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insert(PlaylistSongCross playlistSongCross);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user