From 4c795139ac3b2b8b25faf56c68b5fcb5dbca08c5 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Mon, 6 Jan 2025 13:04:21 +0100 Subject: [PATCH] add DB migration Signed-off-by: Marcel Hibbe --- .../talk/data/source/local/Migrations.kt | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/data/source/local/Migrations.kt b/app/src/main/java/com/nextcloud/talk/data/source/local/Migrations.kt index 8d10b94b3..aacd83375 100644 --- a/app/src/main/java/com/nextcloud/talk/data/source/local/Migrations.kt +++ b/app/src/main/java/com/nextcloud/talk/data/source/local/Migrations.kt @@ -51,7 +51,7 @@ object Migrations { val MIGRATION_12_13 = object : Migration(12, 13) { override fun migrate(db: SupportSQLiteDatabase) { Log.i("Migrations", "Migrating 12 to 13") - addReferenceIdToChatMessages(db) + addTempMessagesSupport(db) } } @@ -265,7 +265,7 @@ object Migrations { } } - fun addReferenceIdToChatMessages(db: SupportSQLiteDatabase) { + fun addTempMessagesSupport(db: SupportSQLiteDatabase) { try { db.execSQL( "ALTER TABLE ChatMessages " + @@ -274,5 +274,23 @@ object Migrations { } catch (e: SQLException) { Log.i("Migrations", "Something went wrong when adding column referenceId to table ChatMessages") } + + try { + db.execSQL( + "ALTER TABLE ChatMessages " + + "ADD COLUMN isTemporary INTEGER NOT NULL DEFAULT 0;" + ) + } catch (e: SQLException) { + Log.i("Migrations", "Something went wrong when adding column isTemporary to table ChatMessages") + } + + try { + db.execSQL( + "ALTER TABLE ChatMessages " + + "ADD COLUMN sendingFailed INTEGER NOT NULL DEFAULT 0;" + ) + } catch (e: SQLException) { + Log.i("Migrations", "Something went wrong when adding column sendingFailed to table ChatMessages") + } } }