marius-wieschollek / passwords

A simple, yet feature rich password manager for Nextcloud
GNU Affero General Public License v3.0
201 stars 39 forks source link

[BUG]: Database error when running migration 20220101 for app passwords #662

Open Gijom opened 1 week ago

Gijom commented 1 week ago

⚠️ This issue respects the following points: ⚠️

Server Information

I can't run `php ./occ passwords:system:report debug` because I cannot install password I thus run `occ support:report`
## Server configuration detail

**Operating system:** Linux 6.4.3-1-MANJARO-ARM-ODROID #1 SMP PREEMPT Wed Aug 30 20:04:07 UTC 2023 aarch64

**Webserver:** Unknown (cli)

**Database:** mysql 11.3.2

**PHP version:** 8.1.27

Modules loaded: Core, date, libxml, openssl, pcre, zlib, ctype, dom, fileinfo, filter, hash, json, mbstring, pcntl, SPL, session, PDO, bz2, posix, readline, Reflection, standard, SimpleXML, tokenizer, xml, xmlreader, xmlwriter, mysqlnd, bcmath, Phar, curl, exif, gd, gmp, iconv, intl, mysqli, pdo_mysql, sodium, sysvsem, zip, apcu, imagick, Zend OPcache

**Nextcloud version:** 28.0.2 - 28.0.2.5

**Updated from an older Nextcloud/ownCloud or fresh install:** 

**Where did you install Nextcloud from:** unknown

<details><summary>Signing status</summary>

{
    "core": {
        "INVALID_HASH": {
            ".htaccess": {
                "expected": "88a3d3200932c66c94e3eceff5091b06766a09629dc8f947c6dbc2b221b0bd832ac7e92e9a10fcf235fc7485d0da539f45ce8383da6f4359a683bace2a651472",
                "current": "d9cab0f077161bf043d6d85f5bcacbdfaf82913968b7706df9cf7e6f98b11af363f3843b455175ae775567916822fec8f6ab95000ba064c71e05c86a02196d95"
            }
        }
    },
    "photos": {
        "EXTRA_FILE": {
            "css\/icons.scss": {
                "expected": "",
                "current": "7334197433f28340d5e7739ed643a203682e007b05c4fc4dcef80c3481a34b22fc60d7e3263f9d53b2010a038a0afa9c3d5dd8cb445bff3ba5c5faae0d939a01"
            }
        }
    },
    "text": {
        "EXTRA_FILE": {
            "l10n\/ta.js": {
                "expected": "",
                "current": "b56476a4ef434d4335edfe7964ee7ece59aac9cd99f3cd89f903f71097bc7e0bad393e7d5d0bbdc14263bd31ed963a851cc78e8cbe687f2259426717536a43c3"
            },
            "l10n\/ta.json": {
                "expected": "",
                "current": "ce26cb9b4b4a1cb043eab09682a37679c58b546d726cf3d1a7042a6917c2e17a4cbb8817ad0624980bb08bcb6c45137f6061f07230622c825e0b1afd226e1bc2"
            }
        }
    }
}
</details>

<details><summary>List of activated apps</summary>

Enabled:
 - activity: 2.20.0
 - announcementcenter: 6.8.1
 - bookmarks: 14.2.2
 - bruteforcesettings: 2.8.0
 - calendar: 4.7.6
 - circles: 28.0.0-dev
 - cloud_federation_api: 1.11.0
 - comments: 1.18.0
 - contacts: 5.5.3
 - contactsinteraction: 1.9.0
 - cospend: 1.6.1
 - dashboard: 7.8.0
 - dav: 1.29.1
 - deck: 1.12.2
 - federatedfilesharing: 1.18.0
 - federation: 1.18.0
 - files: 2.0.0
 - files_pdfviewer: 2.9.0
 - files_reminders: 1.1.0
 - files_sharing: 1.20.0
 - files_trashbin: 1.18.0
 - files_versions: 1.21.0
 - firstrunwizard: 2.17.0
 - groupfolders: 16.0.7
 - logreader: 2.13.0
 - lookup_server_connector: 1.16.0
 - nextcloud_announcements: 1.17.0
 - notes: 4.10.0
 - notifications: 2.16.0
 - oauth2: 1.16.3
 - password_policy: 1.18.0
 - photos: 2.4.0
 - privacy: 1.12.0
 - provisioning_api: 1.18.0
 - recommendations: 2.0.0
 - related_resources: 1.3.0
 - serverinfo: 1.18.0
 - settings: 1.10.1
 - sharebymail: 1.18.0
 - support: 1.11.0
 - survey_client: 1.16.0
 - systemtags: 1.18.0
 - tasks: 0.16.0
 - text: 3.9.1
 - theming: 2.3.0
 - twofactor_backupcodes: 1.17.0
 - twofactor_totp: 10.0.0-beta.2
 - twofactor_webauthn: 1.4.0
 - updatenotification: 1.18.0
 - user_status: 1.8.1
 - viewer: 2.2.0
 - weather_status: 1.8.0
 - workflowengine: 2.10.0
Disabled:
 - admin_audit
 - encryption
 - files_external
 - keeweb: 0.6.18
 - passwords: 2018.11.2
 - suspicious_login: 6.0.0
 - user_ldap

Configuration (config/config.php) ``` { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "192.168.1.4", "93.3.9.233", "cloud.numero-cinq.vip", "localhost" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "apps_paths": [ { "path": "\/usr\/share\/webapps\/nextcloud\/apps", "url": "\/apps", "writable": false }, { "path": "\/var\/lib\/nextcloud\/apps", "url": "\/wapps", "writable": true } ], "dbtype": "mysql", "version": "28.0.2.5", "overwrite.cli.url": "https:\/\/cloud.numero-cinq.vip", "htaccess.RewriteBase": "\/", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "session_lifetime": 900, "memcache.local": "\\OC\\Memcache\\APCu", "mail_smtpmode": "smtp", "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "465", "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_smtpsecure": "ssl", "enable_previews": "false", "theme": "", "logfile": "\/var\/log\/nextcloud\/nextcloud.log", "loglevel": 1, "maintenance": false, "maintenance_window_start": 0, "mysql.utf8mb4": true, "app_install_overwrite": [ "calendar", "deckimportfromtrello" ], "default_phone_region": "FR" } ```

Cron Configuration: Array ( [backgroundjobs_mode] => cron [lastcron] => 1719653274 )

External storages: files_external is disabled

Encryption: no

User-backends:

Browser: unknown

Client Information

Browser and Version: Version 125.0.6422.141 (Official Build) Arch Linux (64-bit) Client OS and Version: Archlinux Linux 6.6.32-1-lts #1 SMP PREEMPT_DYNAMIC Sat, 25 May 2024 20:20:51 +0000 x86_64 GNU/Linux

Bug description

When installing passwords using either occ app:install:passwords or the webinterface I get the message:

Error: Database error when running migration 20220101 for app passwords
There is no column with name "favourite" on table "oc_passwords_folder_rv".

This error seem to be reported here as well: https://help.nextcloud.com/t/there-is-no-column-with-name-favourite-on-table-oc-passwords-folder-rv/139810

My feeling is that I installed passwords a while ago, uninstalled it immedialely. And now the migration script does not take into account this old version.

Probably I should clean up the tables myself but I am worried of doing something wrong (although a database backup would be a mitigation for my clumpsiness)

Steps to reproduce

  1. run occ app:install:passwords

Expected behavior

  1. installs the app and I am good to go
  2. uninstalling/reinstalling does not help

Nextcloud Logs

  Info    passwords           Migrating 1 entries from passwords_entity_folder to passwords_folder                                       2024-06-29T09:11:47+00:00

  Info    passwords           Skipping da27219c-0d05-4b49-80e1-12fa3e7b5c5a because it exists in new table                               2024-06-29T09:11:47+00:00

  Info    passwords           Done                                                                                                       2024-06-29T09:11:47+00:00

  Info    passwords           Migrating 1 entries from passwords_entity_folder_revision to passwords_folder_rv                           2024-06-29T09:11:47+00:00

  Info    passwords           Migrating 1 entries from passwords_entity_folder to passwords_folder                                       2024-06-29T09:14:01+00:00

  Info    passwords           Skipping da27219c-0d05-4b49-80e1-12fa3e7b5c5a because it exists in new table                               2024-06-29T09:14:01+00:00

  Info    passwords           Done                                                                                                       2024-06-29T09:14:01+00:00

  Info    passwords           Migrating 1 entries from passwords_entity_folder_revision to passwords_folder_rv                           2024-06-29T09:14:01+00:00

  Info    passwords           Migrating 1 entries from passwords_entity_folder to passwords_folder                                       2024-06-29T09:27:16+00:00

  Info    passwords           Skipping da27219c-0d05-4b49-80e1-12fa3e7b5c5a because it exists in new table                               2024-06-29T09:27:16+00:00

  Info    passwords           Done                                                                                                       2024-06-29T09:27:16+00:00

Browser Logs

No response

marius-wieschollek commented 6 days ago

Migrating 1 entries from passwords_entity_folder_revision to passwords_folder_rv

You're migrating from an ancient database schema with a column that hadn't existed for years by the time of this update. I have added a patch for this. You can also fix this by renaming the favourites column to favorites (or drop if the second already exists) in the folder_revision, password_revision and tag_revision tables