mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 03:29:28 +01:00
add database migration
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
c337d5087b
commit
b4de86b84e
@ -95,7 +95,7 @@ data class ConversationEntity(
|
|||||||
@ColumnInfo(name = "unreadMentionDirect") var unreadMentionDirect: Boolean,
|
@ColumnInfo(name = "unreadMentionDirect") var unreadMentionDirect: Boolean,
|
||||||
@ColumnInfo(name = "unreadMessages") var unreadMessages: Int = 0,
|
@ColumnInfo(name = "unreadMessages") var unreadMessages: Int = 0,
|
||||||
@ColumnInfo(name = "hasArchived") var hasArchived: Boolean = false,
|
@ColumnInfo(name = "hasArchived") var hasArchived: Boolean = false,
|
||||||
@ColumnInfo(name = "isSensitive") var isSensitive:Boolean = false
|
@ColumnInfo(name = "isSensitive") var isSensitive: Boolean = false
|
||||||
// missing/not needed: attendeeId
|
// missing/not needed: attendeeId
|
||||||
// missing/not needed: attendeePin
|
// missing/not needed: attendeePin
|
||||||
// missing/not needed: attendeePermissions
|
// missing/not needed: attendeePermissions
|
||||||
|
@ -62,6 +62,13 @@ object Migrations {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val MIGRATION_14_15 = object : Migration(14, 15) {
|
||||||
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
|
Log.i("Migrations", "Migrating 14 to 15")
|
||||||
|
addisSensitive(db)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun migrateToRoom(db: SupportSQLiteDatabase) {
|
fun migrateToRoom(db: SupportSQLiteDatabase) {
|
||||||
db.execSQL(
|
db.execSQL(
|
||||||
"CREATE TABLE User_new (" +
|
"CREATE TABLE User_new (" +
|
||||||
@ -283,6 +290,18 @@ object Migrations {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun addisSensitive(db: SupportSQLiteDatabase) {
|
||||||
|
try {
|
||||||
|
db.execSQL(
|
||||||
|
"ALTER TABLE Conversations " +
|
||||||
|
"ADD COLUMN isSensitive INTEGER NOT NULL DEFAULT 0;"
|
||||||
|
)
|
||||||
|
} catch (e: SQLException) {
|
||||||
|
Log.i("Migrations", "Something went wrong when adding column isSensitive to table Conversations")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun addTempMessagesSupport(db: SupportSQLiteDatabase) {
|
fun addTempMessagesSupport(db: SupportSQLiteDatabase) {
|
||||||
try {
|
try {
|
||||||
db.execSQL(
|
db.execSQL(
|
||||||
|
@ -49,7 +49,7 @@ import java.util.Locale
|
|||||||
ChatMessageEntity::class,
|
ChatMessageEntity::class,
|
||||||
ChatBlockEntity::class
|
ChatBlockEntity::class
|
||||||
],
|
],
|
||||||
version = 14,
|
version = 15,
|
||||||
autoMigrations = [
|
autoMigrations = [
|
||||||
AutoMigration(from = 9, to = 10)
|
AutoMigration(from = 9, to = 10)
|
||||||
],
|
],
|
||||||
@ -116,7 +116,8 @@ abstract class TalkDatabase : RoomDatabase() {
|
|||||||
Migrations.MIGRATION_10_11,
|
Migrations.MIGRATION_10_11,
|
||||||
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
|
||||||
)
|
)
|
||||||
.allowMainThreadQueries()
|
.allowMainThreadQueries()
|
||||||
.addCallback(
|
.addCallback(
|
||||||
|
Loading…
Reference in New Issue
Block a user