1 package expo.modules.updates.db.entity
2 
3 import androidx.room.ColumnInfo
4 import androidx.room.Entity
5 import androidx.room.Index
6 import androidx.room.PrimaryKey
7 import java.util.*
8 
9 /**
10  * Data class representing a (potential) row of arbitrary JSON data to be stored in the `json_data`
11  * table in SQLite. The table schema is autogenerated from this file.
12  *
13  * Used to store per-scope data that should be persisted and overridden via key, such as items in
14  * [ManifestMetadata].
15  *
16  * The `scopeKey` field is only relevant in environments such as Expo Go in which updates from
17  * multiple scopes can be launched.
18  */
19 @Entity(tableName = "json_data", indices = [Index(value = ["scope_key"])])
20 class JSONDataEntity(
21   var key: String,
22   var value: String,
23   @field:ColumnInfo(name = "last_updated") var lastUpdated: Date,
24   @field:ColumnInfo(name = "scope_key") var scopeKey: String
25 ) {
26   @PrimaryKey(autoGenerate = true) // 0 is treated as unset while inserting the entity into the db
27   var id: Long = 0
28 }
29