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_9_10.java')
-rw-r--r--app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_9_10.java24
1 files changed, 14 insertions, 10 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_9_10.java b/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_9_10.java
index 9aec3c9b..98ddc601 100644
--- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_9_10.java
+++ b/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_9_10.java
@@ -4,19 +4,23 @@ import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
+import androidx.annotation.NonNull;
+
import it.niedermann.owncloud.notes.util.NoteUtil;
public class Migration_9_10 {
- public Migration_9_10(SQLiteDatabase db, int oldVersion) {
- if (oldVersion < 10) {
- db.execSQL("ALTER TABLE NOTES ADD COLUMN EXCERPT INTEGER NOT NULL DEFAULT ''");
- Cursor cursor = db.query("NOTES", new String[]{"ID", "CONTENT"}, null, null, null, null, null, null);
- while (cursor.moveToNext()) {
- ContentValues values = new ContentValues();
- values.put("EXCERPT", NoteUtil.generateNoteExcerpt(cursor.getString(1)));
- db.update("NOTES", values, "ID" + " = ? ", new String[]{cursor.getString(0)});
- }
- cursor.close();
+ /**
+ * Adds a column to store excerpt instead of regenerating it each time
+ * https://github.com/stefan-niedermann/nextcloud-notes/issues/528
+ */
+ public Migration_9_10(@NonNull SQLiteDatabase db) {
+ db.execSQL("ALTER TABLE NOTES ADD COLUMN EXCERPT INTEGER NOT NULL DEFAULT ''");
+ Cursor cursor = db.query("NOTES", new String[]{"ID", "CONTENT"}, null, null, null, null, null, null);
+ while (cursor.moveToNext()) {
+ ContentValues values = new ContentValues();
+ values.put("EXCERPT", NoteUtil.generateNoteExcerpt(cursor.getString(1)));
+ db.update("NOTES", values, "ID" + " = ? ", new String[]{cursor.getString(0)});
}
+ cursor.close();
}
}