Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit a6a60c5e authored by Alper Öztürk's avatar Alper Öztürk Committed by GitHub
Browse files

Merge pull request #2687 from nextcloud/bugfix/missing-db-migration-26

BugFix - Add missing migration 26
parents 3878f007 e6e86758
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ SPDX-PackageSupplier = "Nextcloud Android team <android@nextcloud.com>"
SPDX-PackageDownloadLocation = "https://github.com/nextcloud/notes-android"

[[annotations]]
path = ["app/src/main/res/values-**/strings.xml", "renovate.json5", "**/.gitignore", ".idea/**", "scripts/analysis/findbugs-results.txt", "scripts/analysis/lint-results.txt", "app/src/test/resources/robolectric.properties", "app/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker", "fastlane/metadata/**", "app/src/main/res/mipmap-**dpi/ic_launcher.png", "app/src/main/ic_launcher-web.png", ".bundle/config", "app/src/main/res/drawable-**dpi/ic_widget_create.png", "app/src/main/res/drawable-mdpi/context_based_formatting.png", "app/src/main/res/drawable/note_list_widget_preview.webp", "app/src/main/res/drawable/single_note_widget.webp"]
path = ["app/schemas/it.niedermann.owncloud.notes.persistence.NotesDatabase/**.json", "app/src/main/res/values-**/strings.xml", "renovate.json5", "**/.gitignore", ".idea/**", "scripts/analysis/findbugs-results.txt", "scripts/analysis/lint-results.txt", "app/src/test/resources/robolectric.properties", "app/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker", "fastlane/metadata/**", "app/src/main/res/mipmap-**dpi/ic_launcher.png", "app/src/main/ic_launcher-web.png", ".bundle/config", "app/src/main/res/drawable-**dpi/ic_widget_create.png", "app/src/main/res/drawable-mdpi/context_based_formatting.png", "app/src/main/res/drawable/note_list_widget_preview.webp", "app/src/main/res/drawable/single_note_widget.webp"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2016-2024 Nextcloud GmbH and Nextcloud contributors"
SPDX-License-Identifier = "GPL-3.0-or-later"
+552 −0
Original line number Diff line number Diff line
{
  "formatVersion": 1,
  "database": {
    "version": 23,
    "identityHash": "5fc7181c6704e064e93b6eed8671aebb",
    "entities": [
      {
        "tableName": "Account",
        "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `url` TEXT NOT NULL DEFAULT '', `userName` TEXT NOT NULL DEFAULT '', `accountName` TEXT NOT NULL DEFAULT '', `eTag` TEXT, `modified` INTEGER, `apiVersion` TEXT, `color` INTEGER NOT NULL DEFAULT -16743735, `textColor` INTEGER NOT NULL DEFAULT -16777216, `capabilitiesETag` TEXT, `displayName` TEXT)",
        "fields": [
          {
            "fieldPath": "id",
            "columnName": "id",
            "affinity": "INTEGER",
            "notNull": true
          },
          {
            "fieldPath": "url",
            "columnName": "url",
            "affinity": "TEXT",
            "notNull": true,
            "defaultValue": "''"
          },
          {
            "fieldPath": "userName",
            "columnName": "userName",
            "affinity": "TEXT",
            "notNull": true,
            "defaultValue": "''"
          },
          {
            "fieldPath": "accountName",
            "columnName": "accountName",
            "affinity": "TEXT",
            "notNull": true,
            "defaultValue": "''"
          },
          {
            "fieldPath": "eTag",
            "columnName": "eTag",
            "affinity": "TEXT",
            "notNull": false
          },
          {
            "fieldPath": "modified",
            "columnName": "modified",
            "affinity": "INTEGER",
            "notNull": false
          },
          {
            "fieldPath": "apiVersion",
            "columnName": "apiVersion",
            "affinity": "TEXT",
            "notNull": false
          },
          {
            "fieldPath": "color",
            "columnName": "color",
            "affinity": "INTEGER",
            "notNull": true,
            "defaultValue": "-16743735"
          },
          {
            "fieldPath": "textColor",
            "columnName": "textColor",
            "affinity": "INTEGER",
            "notNull": true,
            "defaultValue": "-16777216"
          },
          {
            "fieldPath": "capabilitiesETag",
            "columnName": "capabilitiesETag",
            "affinity": "TEXT",
            "notNull": false
          },
          {
            "fieldPath": "displayName",
            "columnName": "displayName",
            "affinity": "TEXT",
            "notNull": false
          }
        ],
        "primaryKey": {
          "columnNames": [
            "id"
          ],
          "autoGenerate": true
        },
        "indices": [
          {
            "name": "IDX_ACCOUNT_MODIFIED",
            "unique": false,
            "columnNames": [
              "modified"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_ACCOUNT_MODIFIED` ON `${TABLE_NAME}` (`modified`)"
          },
          {
            "name": "IDX_ACCOUNT_URL",
            "unique": false,
            "columnNames": [
              "url"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_ACCOUNT_URL` ON `${TABLE_NAME}` (`url`)"
          },
          {
            "name": "IDX_ACCOUNT_USERNAME",
            "unique": false,
            "columnNames": [
              "userName"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_ACCOUNT_USERNAME` ON `${TABLE_NAME}` (`userName`)"
          },
          {
            "name": "IDX_ACCOUNT_ACCOUNTNAME",
            "unique": false,
            "columnNames": [
              "accountName"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_ACCOUNT_ACCOUNTNAME` ON `${TABLE_NAME}` (`accountName`)"
          },
          {
            "name": "IDX_ACCOUNT_ETAG",
            "unique": false,
            "columnNames": [
              "eTag"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_ACCOUNT_ETAG` ON `${TABLE_NAME}` (`eTag`)"
          }
        ],
        "foreignKeys": []
      },
      {
        "tableName": "Note",
        "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `remoteId` INTEGER, `accountId` INTEGER NOT NULL, `status` TEXT NOT NULL, `title` TEXT NOT NULL DEFAULT '', `category` TEXT NOT NULL DEFAULT '', `modified` INTEGER, `content` TEXT NOT NULL DEFAULT '', `favorite` INTEGER NOT NULL DEFAULT 0, `eTag` TEXT, `excerpt` TEXT NOT NULL DEFAULT '', `scrollY` INTEGER NOT NULL DEFAULT 0, FOREIGN KEY(`accountId`) REFERENCES `Account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
        "fields": [
          {
            "fieldPath": "id",
            "columnName": "id",
            "affinity": "INTEGER",
            "notNull": true
          },
          {
            "fieldPath": "remoteId",
            "columnName": "remoteId",
            "affinity": "INTEGER",
            "notNull": false
          },
          {
            "fieldPath": "accountId",
            "columnName": "accountId",
            "affinity": "INTEGER",
            "notNull": true
          },
          {
            "fieldPath": "status",
            "columnName": "status",
            "affinity": "TEXT",
            "notNull": true
          },
          {
            "fieldPath": "title",
            "columnName": "title",
            "affinity": "TEXT",
            "notNull": true,
            "defaultValue": "''"
          },
          {
            "fieldPath": "category",
            "columnName": "category",
            "affinity": "TEXT",
            "notNull": true,
            "defaultValue": "''"
          },
          {
            "fieldPath": "modified",
            "columnName": "modified",
            "affinity": "INTEGER",
            "notNull": false
          },
          {
            "fieldPath": "content",
            "columnName": "content",
            "affinity": "TEXT",
            "notNull": true,
            "defaultValue": "''"
          },
          {
            "fieldPath": "favorite",
            "columnName": "favorite",
            "affinity": "INTEGER",
            "notNull": true,
            "defaultValue": "0"
          },
          {
            "fieldPath": "eTag",
            "columnName": "eTag",
            "affinity": "TEXT",
            "notNull": false
          },
          {
            "fieldPath": "excerpt",
            "columnName": "excerpt",
            "affinity": "TEXT",
            "notNull": true,
            "defaultValue": "''"
          },
          {
            "fieldPath": "scrollY",
            "columnName": "scrollY",
            "affinity": "INTEGER",
            "notNull": true,
            "defaultValue": "0"
          }
        ],
        "primaryKey": {
          "columnNames": [
            "id"
          ],
          "autoGenerate": true
        },
        "indices": [
          {
            "name": "IDX_NOTE_ACCOUNTID",
            "unique": false,
            "columnNames": [
              "accountId"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_NOTE_ACCOUNTID` ON `${TABLE_NAME}` (`accountId`)"
          },
          {
            "name": "IDX_NOTE_CATEGORY",
            "unique": false,
            "columnNames": [
              "category"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_NOTE_CATEGORY` ON `${TABLE_NAME}` (`category`)"
          },
          {
            "name": "IDX_NOTE_FAVORITE",
            "unique": false,
            "columnNames": [
              "favorite"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_NOTE_FAVORITE` ON `${TABLE_NAME}` (`favorite`)"
          },
          {
            "name": "IDX_NOTE_MODIFIED",
            "unique": false,
            "columnNames": [
              "modified"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_NOTE_MODIFIED` ON `${TABLE_NAME}` (`modified`)"
          },
          {
            "name": "IDX_NOTE_REMOTEID",
            "unique": false,
            "columnNames": [
              "remoteId"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_NOTE_REMOTEID` ON `${TABLE_NAME}` (`remoteId`)"
          },
          {
            "name": "IDX_NOTE_STATUS",
            "unique": false,
            "columnNames": [
              "status"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_NOTE_STATUS` ON `${TABLE_NAME}` (`status`)"
          }
        ],
        "foreignKeys": [
          {
            "table": "Account",
            "onDelete": "CASCADE",
            "onUpdate": "NO ACTION",
            "columns": [
              "accountId"
            ],
            "referencedColumns": [
              "id"
            ]
          }
        ]
      },
      {
        "tableName": "CategoryOptions",
        "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`accountId` INTEGER NOT NULL, `category` TEXT NOT NULL, `sortingMethod` INTEGER, PRIMARY KEY(`accountId`, `category`), FOREIGN KEY(`accountId`) REFERENCES `Account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
        "fields": [
          {
            "fieldPath": "accountId",
            "columnName": "accountId",
            "affinity": "INTEGER",
            "notNull": true
          },
          {
            "fieldPath": "category",
            "columnName": "category",
            "affinity": "TEXT",
            "notNull": true
          },
          {
            "fieldPath": "sortingMethod",
            "columnName": "sortingMethod",
            "affinity": "INTEGER",
            "notNull": false
          }
        ],
        "primaryKey": {
          "columnNames": [
            "accountId",
            "category"
          ],
          "autoGenerate": false
        },
        "indices": [
          {
            "name": "IDX_CATEGORIYOPTIONS_ACCOUNTID",
            "unique": false,
            "columnNames": [
              "accountId"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_CATEGORIYOPTIONS_ACCOUNTID` ON `${TABLE_NAME}` (`accountId`)"
          },
          {
            "name": "IDX_CATEGORIYOPTIONS_CATEGORY",
            "unique": false,
            "columnNames": [
              "category"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_CATEGORIYOPTIONS_CATEGORY` ON `${TABLE_NAME}` (`category`)"
          },
          {
            "name": "IDX_CATEGORIYOPTIONS_SORTING_METHOD",
            "unique": false,
            "columnNames": [
              "sortingMethod"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_CATEGORIYOPTIONS_SORTING_METHOD` ON `${TABLE_NAME}` (`sortingMethod`)"
          },
          {
            "name": "IDX_UNIQUE_CATEGORYOPTIONS_ACCOUNT_CATEGORY",
            "unique": true,
            "columnNames": [
              "accountId",
              "category"
            ],
            "orders": [],
            "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `IDX_UNIQUE_CATEGORYOPTIONS_ACCOUNT_CATEGORY` ON `${TABLE_NAME}` (`accountId`, `category`)"
          }
        ],
        "foreignKeys": [
          {
            "table": "Account",
            "onDelete": "CASCADE",
            "onUpdate": "NO ACTION",
            "columns": [
              "accountId"
            ],
            "referencedColumns": [
              "id"
            ]
          }
        ]
      },
      {
        "tableName": "SingleNoteWidgetData",
        "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`noteId` INTEGER NOT NULL, `id` INTEGER NOT NULL, `accountId` INTEGER NOT NULL, `themeMode` INTEGER NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`accountId`) REFERENCES `Account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`noteId`) REFERENCES `Note`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
        "fields": [
          {
            "fieldPath": "noteId",
            "columnName": "noteId",
            "affinity": "INTEGER",
            "notNull": true
          },
          {
            "fieldPath": "id",
            "columnName": "id",
            "affinity": "INTEGER",
            "notNull": true
          },
          {
            "fieldPath": "accountId",
            "columnName": "accountId",
            "affinity": "INTEGER",
            "notNull": true
          },
          {
            "fieldPath": "themeMode",
            "columnName": "themeMode",
            "affinity": "INTEGER",
            "notNull": true
          }
        ],
        "primaryKey": {
          "columnNames": [
            "id"
          ],
          "autoGenerate": false
        },
        "indices": [
          {
            "name": "IDX_SINGLENOTEWIDGETDATA_ACCOUNTID",
            "unique": false,
            "columnNames": [
              "accountId"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_SINGLENOTEWIDGETDATA_ACCOUNTID` ON `${TABLE_NAME}` (`accountId`)"
          },
          {
            "name": "IDX_SINGLENOTEWIDGETDATA_NOTEID",
            "unique": false,
            "columnNames": [
              "noteId"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_SINGLENOTEWIDGETDATA_NOTEID` ON `${TABLE_NAME}` (`noteId`)"
          }
        ],
        "foreignKeys": [
          {
            "table": "Account",
            "onDelete": "CASCADE",
            "onUpdate": "NO ACTION",
            "columns": [
              "accountId"
            ],
            "referencedColumns": [
              "id"
            ]
          },
          {
            "table": "Note",
            "onDelete": "CASCADE",
            "onUpdate": "NO ACTION",
            "columns": [
              "noteId"
            ],
            "referencedColumns": [
              "id"
            ]
          }
        ]
      },
      {
        "tableName": "NotesListWidgetData",
        "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`mode` INTEGER NOT NULL, `category` TEXT, `id` INTEGER NOT NULL, `accountId` INTEGER NOT NULL, `themeMode` INTEGER NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`accountId`) REFERENCES `Account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
        "fields": [
          {
            "fieldPath": "mode",
            "columnName": "mode",
            "affinity": "INTEGER",
            "notNull": true
          },
          {
            "fieldPath": "category",
            "columnName": "category",
            "affinity": "TEXT",
            "notNull": false
          },
          {
            "fieldPath": "id",
            "columnName": "id",
            "affinity": "INTEGER",
            "notNull": true
          },
          {
            "fieldPath": "accountId",
            "columnName": "accountId",
            "affinity": "INTEGER",
            "notNull": true
          },
          {
            "fieldPath": "themeMode",
            "columnName": "themeMode",
            "affinity": "INTEGER",
            "notNull": true
          }
        ],
        "primaryKey": {
          "columnNames": [
            "id"
          ],
          "autoGenerate": false
        },
        "indices": [
          {
            "name": "IDX_NOTESLISTWIDGETDATA_ACCOUNTID",
            "unique": false,
            "columnNames": [
              "accountId"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_NOTESLISTWIDGETDATA_ACCOUNTID` ON `${TABLE_NAME}` (`accountId`)"
          },
          {
            "name": "IDX_NOTESLISTWIDGETDATA_CATEGORY",
            "unique": false,
            "columnNames": [
              "category"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_NOTESLISTWIDGETDATA_CATEGORY` ON `${TABLE_NAME}` (`category`)"
          },
          {
            "name": "IDX_NOTESLISTWIDGETDATA_ACCOUNT_CATEGORY",
            "unique": false,
            "columnNames": [
              "accountId",
              "category"
            ],
            "orders": [],
            "createSql": "CREATE INDEX IF NOT EXISTS `IDX_NOTESLISTWIDGETDATA_ACCOUNT_CATEGORY` ON `${TABLE_NAME}` (`accountId`, `category`)"
          }
        ],
        "foreignKeys": [
          {
            "table": "Account",
            "onDelete": "CASCADE",
            "onUpdate": "NO ACTION",
            "columns": [
              "accountId"
            ],
            "referencedColumns": [
              "id"
            ]
          }
        ]
      }
    ],
    "views": [],
    "setupQueries": [
      "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
      "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '5fc7181c6704e064e93b6eed8671aebb')"
    ]
  }
}
 No newline at end of file
+558 −0

File added.

Preview size limit exceeded, changes collapsed.

+736 −0

File added.

Preview size limit exceeded, changes collapsed.

+3 −3
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ import android.content.Context;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.room.AutoMigration;
import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;
@@ -57,7 +58,8 @@ import it.niedermann.owncloud.notes.shared.model.Capabilities;
                NotesListWidgetData.class,
                ShareEntity.class,
                Capabilities.class
        }, version = 26
        }, version = 26,
        autoMigrations = { @AutoMigration(from = 25, to = 26) }
)
@TypeConverters({Converters.class})
public abstract class NotesDatabase extends RoomDatabase {
@@ -96,8 +98,6 @@ public abstract class NotesDatabase extends RoomDatabase {
                        new Migration_23_24(context),
                        new Migration_24_25()
                )
                .fallbackToDestructiveMigrationOnDowngrade()
                .fallbackToDestructiveMigration()
                .addCallback(new RoomDatabase.Callback() {
                    @Override
                    public void onCreate(@NonNull SupportSQLiteDatabase db) {