Successfully completed database change OMG; this will save memory by storing less duplicate data

This commit is contained in:
denizk0461
2023-04-17 14:19:06 +02:00
parent 4d520f375b
commit 315f2f815a
8 changed files with 137 additions and 57 deletions
@@ -1,16 +1,15 @@
package com.denizk0461.studip.model
import androidx.room.Entity
import androidx.room.PrimaryKey
//@Entity(tableName = "offers")
data class CanteenOffer(
// @PrimaryKey val id: Int,
val id: Int,
val date: String,
val dateId: Int, // gives every item on the same day the same ID for easier filtering
// val canteen: Int,
val dateId: Int,
val category: String,
val categoryId: Int,
val canteen: String,
val canteenId: Int,
val title: String,
val price: String, // price for students
val isFair: Boolean, // artgerechte Tierhaltung
@@ -1,6 +1,5 @@
package com.denizk0461.studip.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.PrimaryKey
@@ -11,20 +10,20 @@ import androidx.room.PrimaryKey
ForeignKey(
OfferDate::class,
["id"],
["date_id"],
["dateId"],
ForeignKey.CASCADE,
),
ForeignKey(
OfferCanteen::class,
["id"],
["canteen_id"],
["canteenId"],
ForeignKey.CASCADE,
),
]
)
data class OfferCategory(
@PrimaryKey val id: Int,
@ColumnInfo(name = "date_id") val dateId: Int,
@ColumnInfo(name = "canteen_id") val canteenId: Int,
val dateId: Int,
val canteenId: Int,
val category: String,
)
@@ -1,6 +1,5 @@
package com.denizk0461.studip.model
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.PrimaryKey
@@ -11,15 +10,15 @@ import androidx.room.PrimaryKey
ForeignKey(
OfferCategory::class,
["id"],
["category_id"],
["categoryId"],
ForeignKey.CASCADE,
),
]
)
data class OfferItem(
@PrimaryKey val id: Int,
@ColumnInfo(name = "category_id") val categoryId: Int,
val title: Int,
val categoryId: Int,
val title: String,
val price: String,
val isFair: Boolean,
val isFish: Boolean,