mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 03:29:28 +01:00
modify database scheme
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
2e41b27dc8
commit
a943dc1070
@ -69,6 +69,26 @@ object Migrations {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val MIGRATION_15_16 = object : Migration(15, 16) {
|
||||||
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
|
Log.i("Migrations", "Migrating 15 to 16")
|
||||||
|
addisImportant(db)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun addisImportant(db: SupportSQLiteDatabase) {
|
||||||
|
try {
|
||||||
|
db.execSQL(
|
||||||
|
"ALTER TABLE Conversations " +
|
||||||
|
"ADD COLUMN hasImportant INTEGER NOT NULL DEFAULT 0;"
|
||||||
|
)
|
||||||
|
} catch (e: SQLException) {
|
||||||
|
Log.i("Migrations", "Something went wrong when adding column hasImportant to table Conversations")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun migrateToRoom(db: SupportSQLiteDatabase) {
|
fun migrateToRoom(db: SupportSQLiteDatabase) {
|
||||||
db.execSQL(
|
db.execSQL(
|
||||||
"CREATE TABLE User_new (" +
|
"CREATE TABLE User_new (" +
|
||||||
|
@ -49,7 +49,7 @@ import java.util.Locale
|
|||||||
ChatMessageEntity::class,
|
ChatMessageEntity::class,
|
||||||
ChatBlockEntity::class
|
ChatBlockEntity::class
|
||||||
],
|
],
|
||||||
version = 15,
|
version = 16,
|
||||||
autoMigrations = [
|
autoMigrations = [
|
||||||
AutoMigration(from = 9, to = 10)
|
AutoMigration(from = 9, to = 10)
|
||||||
],
|
],
|
||||||
@ -117,7 +117,8 @@ abstract class TalkDatabase : RoomDatabase() {
|
|||||||
Migrations.MIGRATION_11_12,
|
Migrations.MIGRATION_11_12,
|
||||||
Migrations.MIGRATION_12_13,
|
Migrations.MIGRATION_12_13,
|
||||||
Migrations.MIGRATION_13_14,
|
Migrations.MIGRATION_13_14,
|
||||||
Migrations.MIGRATION_14_15
|
Migrations.MIGRATION_14_15,
|
||||||
|
Migrations.MIGRATION_15_16
|
||||||
)
|
)
|
||||||
.allowMainThreadQueries()
|
.allowMainThreadQueries()
|
||||||
.addCallback(
|
.addCallback(
|
||||||
|
Loading…
Reference in New Issue
Block a user