lawlorslaw
01/28/2019, 1:02 AM@Entity(tableName = "firestore_spot", primaryKeys = arrayOf("spot_id", "date"))
data class FirestoreSpotEntity(
@ColumnInfo(name = "county_name")
val countyName: String,
@ColumnInfo(name = "forecasts")
val forecasts: List<FirestoreForecastEntity>,
@ColumnInfo(name = "latitude")
val latitude: Float,
@ColumnInfo(name = "longitude")
val longitude: Float,
@ColumnInfo(name = "spot_id")
val spotId: Long,
@ColumnInfo(name = "spot_name")
val spotName: String,
@ColumnInfo(name = "date")
val date: Date
)
Here is what my migration looks like so far :
class Migration1To2 : Migration(1, 2) {
override fun migrate(database: SupportSQLiteDatabase) {
val TABLE_NAME = "firestore_spot"
database.execSQL("CREATE TABLE '" + TABLE_NAME + "' ('county_name' TEXT, " +
"'forecasts' TEXT, 'latitude' TEXT, 'longitude' TEXT, 'spot_id' TEXT, 'spot_name' TEXT, " +
"'date' TEXT)")
}
}
For columns that are of type String, its pretty straightforward you just use TEXT as the type of the field.
But what do i have to do for the other 3 types (List<FirestoreForecastEntity>, Float, and Date)?