1 package expo.modules.updates.db.entity 2 3 import androidx.room.ColumnInfo 4 import androidx.room.Entity 5 import androidx.room.ForeignKey 6 import androidx.room.Index 7 import java.util.* 8 9 /** 10 * Data class that represents a (potential) row in the `updates_assets` table, the schema for which 11 * is autogenerated from this file. 12 * 13 * This entity exists only within the database framework, to represent the many-to-many relation 14 * between updates and assets. It should not be used by any other outside classes. 15 */ 16 @Entity( 17 tableName = "updates_assets", 18 primaryKeys = ["update_id", "asset_id"], 19 foreignKeys = [ 20 ForeignKey( 21 entity = UpdateEntity::class, 22 parentColumns = ["id"], 23 childColumns = ["update_id"], 24 onDelete = ForeignKey.CASCADE 25 ), ForeignKey( 26 entity = AssetEntity::class, 27 parentColumns = ["id"], 28 childColumns = ["asset_id"], 29 onDelete = ForeignKey.CASCADE 30 ) 31 ], 32 indices = [Index(value = ["asset_id"])] 33 ) 34 class UpdateAssetEntity( 35 @field:ColumnInfo(name = "update_id") var updateId: UUID, 36 @field:ColumnInfo(name = "asset_id") var assetId: Long 37 ) 38