Loading app/src/main/java/foundation/e/notes/migration/Migration_23_24.kt 0 → 100644 +38 −0 Original line number Diff line number Diff line /* * Copyright e Foundation 2025 * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package foundation.e.notes.migration import androidx.room.migration.Migration import androidx.sqlite.db.SupportSQLiteDatabase class Migration_23_24 : Migration(23, 24) { override fun migrate(db: SupportSQLiteDatabase) { db.execSQL( """ UPDATE `Note` SET status = 'LOCAL_EDITED' WHERE (status IS NULL OR status = '') AND accountId IN ( SELECT id FROM `Account` WHERE userName != 'Local' AND url IS NOT NULL AND url != '' ); """.trimIndent() ) } } app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesDatabase.java +4 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase; import java.util.List; import foundation.e.notes.migration.Migration_23_24; import it.niedermann.owncloud.notes.persistence.dao.AccountDao; import it.niedermann.owncloud.notes.persistence.dao.CategoryOptionsDao; import it.niedermann.owncloud.notes.persistence.dao.NoteDao; Loading Loading @@ -45,7 +46,7 @@ import trikita.log.Log; CategoryOptions.class, SingleNoteWidgetData.class, NotesListWidgetData.class }, version = 23 }, version = 24 ) @TypeConverters({Converters.class}) public abstract class NotesDatabase extends RoomDatabase { Loading Loading @@ -80,7 +81,8 @@ public abstract class NotesDatabase extends RoomDatabase { new Migration_19_20(context), new Migration_20_21(), new Migration_21_22(context), new Migration_22_23() new Migration_22_23(), new Migration_23_24() ) .fallbackToDestructiveMigrationOnDowngrade() .fallbackToDestructiveMigration() Loading Loading
app/src/main/java/foundation/e/notes/migration/Migration_23_24.kt 0 → 100644 +38 −0 Original line number Diff line number Diff line /* * Copyright e Foundation 2025 * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package foundation.e.notes.migration import androidx.room.migration.Migration import androidx.sqlite.db.SupportSQLiteDatabase class Migration_23_24 : Migration(23, 24) { override fun migrate(db: SupportSQLiteDatabase) { db.execSQL( """ UPDATE `Note` SET status = 'LOCAL_EDITED' WHERE (status IS NULL OR status = '') AND accountId IN ( SELECT id FROM `Account` WHERE userName != 'Local' AND url IS NOT NULL AND url != '' ); """.trimIndent() ) } }
app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesDatabase.java +4 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase; import java.util.List; import foundation.e.notes.migration.Migration_23_24; import it.niedermann.owncloud.notes.persistence.dao.AccountDao; import it.niedermann.owncloud.notes.persistence.dao.CategoryOptionsDao; import it.niedermann.owncloud.notes.persistence.dao.NoteDao; Loading Loading @@ -45,7 +46,7 @@ import trikita.log.Log; CategoryOptions.class, SingleNoteWidgetData.class, NotesListWidgetData.class }, version = 23 }, version = 24 ) @TypeConverters({Converters.class}) public abstract class NotesDatabase extends RoomDatabase { Loading Loading @@ -80,7 +81,8 @@ public abstract class NotesDatabase extends RoomDatabase { new Migration_19_20(context), new Migration_20_21(), new Migration_21_22(context), new Migration_22_23() new Migration_22_23(), new Migration_23_24() ) .fallbackToDestructiveMigrationOnDowngrade() .fallbackToDestructiveMigration() Loading