Start with no cars so the first one is added on purpose.
This commit is contained in:
1 parent
a164d9c135
commit
13451a9955
8 files changed
+90
-37
No files matched your search
@@ -246,19 +246,6 @@ abstract class AppDatabase : RoomDatabase() {
|
||||
fun create(context: Context): AppDatabase {
|
||||
return Room.databaseBuilder(context, AppDatabase::class.java, "pitlog.db")
|
||||
.addMigrations(MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4, MIGRATION_4_5, MIGRATION_5_6, MIGRATION_6_7, MIGRATION_7_8, MIGRATION_8_9)
|
||||
.addCallback(
|
||||
object : Callback() {
|
||||
override fun onCreate(db: SupportSQLiteDatabase) {
|
||||
super.onCreate(db)
|
||||
db.execSQL(
|
||||
"""
|
||||
INSERT INTO cars (carName, raceClass, discipline, token, updatedAt, syncRev, deleted, pending)
|
||||
VALUES ('$DEFAULT_CAR', '$DEFAULT_CLASS', '$DEFAULT_DISCIPLINE', printf('%08d', abs(random()) % 100000000), 1, 0, 0, 1)
|
||||
""".trimIndent(),
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user