Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-notes.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_4_5.java')
-rw-r--r--app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_4_5.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_4_5.java b/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_4_5.java
index aa807944..701320c9 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_4_5.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_4_5.java
@@ -1,14 +1,20 @@
package it.niedermann.owncloud.notes.persistence.migration;
-import android.database.sqlite.SQLiteDatabase;
-
import androidx.annotation.NonNull;
+import androidx.room.migration.Migration;
+import androidx.sqlite.db.SupportSQLiteDatabase;
+
+public class Migration_4_5 extends Migration {
+
+ public Migration_4_5() {
+ super(4, 5);
+ }
-public class Migration_4_5 {
/**
* Differentiate between local id and remote id
*/
- public Migration_4_5(@NonNull SQLiteDatabase db) {
+ @Override
+ public void migrate(@NonNull SupportSQLiteDatabase db) {
db.execSQL("ALTER TABLE NOTES ADD COLUMN REMOTEID INTEGER");
db.execSQL("UPDATE NOTES SET REMOTEID=ID WHERE (REMOTEID IS NULL OR REMOTEID=0) AND STATUS!=?", new String[]{"LOCAL_CREATED"});
db.execSQL("UPDATE NOTES SET REMOTEID=0, STATUS=? WHERE STATUS=?", new String[]{"LOCAL_EDITED", "LOCAL_CREATED"});