diff --git a/app/src/main/java/gallery/memories/dao/AppDatabase.kt b/app/src/main/java/gallery/memories/dao/AppDatabase.kt index 57532955..7b1f92c0 100644 --- a/app/src/main/java/gallery/memories/dao/AppDatabase.kt +++ b/app/src/main/java/gallery/memories/dao/AppDatabase.kt @@ -9,7 +9,7 @@ import gallery.memories.R import gallery.memories.mapper.Photo -@Database(entities = [Photo::class], version = 8) +@Database(entities = [Photo::class], version = 9) abstract class AppDatabase : RoomDatabase() { abstract fun photoDao(): PhotoDao diff --git a/app/src/main/java/gallery/memories/mapper/Photo.kt b/app/src/main/java/gallery/memories/mapper/Photo.kt index 3acbe0d5..82f2d727 100644 --- a/app/src/main/java/gallery/memories/mapper/Photo.kt +++ b/app/src/main/java/gallery/memories/mapper/Photo.kt @@ -2,18 +2,28 @@ package gallery.memories.mapper import androidx.room.ColumnInfo import androidx.room.Entity +import androidx.room.Index import androidx.room.PrimaryKey -@Entity(tableName="photos") -data class Photo ( +@Entity( + tableName = "photos", indices = [ + Index(value = ["local_id"]), + Index(value = ["auid"]), + Index(value = ["dayid"]), + Index(value = ["flag"]), + Index(value = ["bucket_id"]), + Index(value = ["bucket_id", "dayid"]) + ] +) +data class Photo( @PrimaryKey(autoGenerate = true) val id: Int? = null, - @ColumnInfo(name="local_id") val localId: Long, - @ColumnInfo(name="auid") val auid: Long, - @ColumnInfo(name="mtime") val mtime: Long, - @ColumnInfo(name="date_taken") val dateTaken: Long, - @ColumnInfo(name="dayid") val dayId: Long, - @ColumnInfo(name="basename") val baseName: String, - @ColumnInfo(name="bucket_id") val bucketId: Long, - @ColumnInfo(name="bucket_name") val bucketName: String, - @ColumnInfo(name="flag") val flag: Int + @ColumnInfo(name = "local_id") val localId: Long, + @ColumnInfo(name = "auid") val auid: Long, + @ColumnInfo(name = "mtime") val mtime: Long, + @ColumnInfo(name = "date_taken") val dateTaken: Long, + @ColumnInfo(name = "dayid") val dayId: Long, + @ColumnInfo(name = "basename") val baseName: String, + @ColumnInfo(name = "bucket_id") val bucketId: Long, + @ColumnInfo(name = "bucket_name") val bucketName: String, + @ColumnInfo(name = "flag") val flag: Int ) \ No newline at end of file