Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade failed with DB error - Syntax error or access violation: 1091 Can't DROP FOREIGN KEY FK_368A4209A76ED395; check that it exists #161

Closed
Jaxom99 opened this issue Jan 27, 2023 · 6 comments
Labels

Comments

@Jaxom99
Copy link

Jaxom99 commented Jan 27, 2023

Describe the bug

When upgrading the app, upgrade fails with this error. I don't think I made any change to database or other settings of the app.
Also the app is broken now, displays only a white page, and booklet doesn't work anymore...

Thanks for anyone spending some time to look it up 😸

Context

  • Hardware: VPS bought online
  • YunoHost version: 11.0.11
  • I have access to my server: Through SSH .
  • Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: no
  • Using, or trying to install package version/branch: latest release, no testing.
  • If upgrading, current package version: 2.3.8~ynh4

Steps to reproduce

yunohost tools upgrade apps when wallabag2 is in the list of upgradable apps.

Expected behavior

The app should upgrade to latest version.

Logs

link : yunohost log share 20230127-100910-app_upgrade-wallabag2

Relevant extract :

Info: [###############++++.] > Reconfiguring wallabag...
Warning: 11:14:12 ERROR     [console] Error thrown while running command "--no-interaction --env=prod doctrine:migrations:migrate". Message: "An exception occurred while executing 'ALTER TABLE `oauth2_access_tokens` DROP FOREIGN KEY FK_368A4209A76ED395':
Warning: SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP FOREIGN KEY `FK_368A4209A76ED395`; check that it exists" ["exception" => Doctrine\DBAL\Exception\DriverException { …},"command" => "--no-interaction --env=prod doctrine:migrations:migrate","message" => """  An exception occurred while executing 'ALTER TABLE `oauth2_access_tokens` DROP FOREIGN KEY FK_368A4209A76ED395':\n  \n  SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP FOREIGN KEY `FK_368A4209A76ED395`; check that it exists  """]
Warning: In AbstractMySQLDriver.php line 128:
Warning:   An exception occurred while executing 'ALTER TABLE `oauth2_access_tokens` DROP FOREIGN KEY FK_368A4209A76ED395':
Warning:   SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP FOREIGN KEY `FK_368A4209A76ED395`; check that it exists
Warning: In Exception.php line 18:
Warning:   SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP FOREIGN KEY `FK_368A4209A76ED395`; check that it exists
Warning: In PDOConnection.php line 141:
Warning:   SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP FOREIGN KEY `FK_368A4209A76ED395`; check that it exists
Warning: doctrine:migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--allow-no-migration] [--configuration [CONFIGURATION]] [--db-configuration [DB-CONFIGURATION]] [--db DB] [--em EM] [--shard SHARD] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<version>]
Warning: [Error] Upgrade failed.

@lapineige
Copy link
Member

You wallabag was installed before 2018 I guess ?

That an issue with old installations.

There is a manual fix, or a branch that is supposed to fix it for you. #133
yunohost app upgrade wallabag2 -u https://github.com/nicofrand/wallabag2_ynh/tree/upgrade-database-scheme

@lapineige lapineige added the bug label Jan 28, 2023
@Jaxom99
Copy link
Author

Jaxom99 commented Jan 28, 2023

Oh, thanks for pointing this out, will try ASAP. Is this traced somewhere ? Should it be ?

Is there anything I must do afterwards to "fall back" to stable releases of the app ?

@lapineige
Copy link
Member

The is an open issue and 2 related pull requests, but it's a bit of a mess to follow 😅

After upgrading to that branch, do a normal upgrade (to the lastest version).

Be sure to have a proper backup before :) (the upgrade will do an automatic one, but they are overwritten after 2 of them)

@Jaxom99
Copy link
Author

Jaxom99 commented Jan 28, 2023

And bingo, fully upgraded. Thanks again, long-live free software and self-hosting !

@lapineige
Copy link
Member

Great !

@JocelynDelalande
Copy link

Hi, got the same error, I guess for the same reasons. I'm upgrading from 2.3.8~ynh3 ; on yunohost 11.2.31

@lapineige your workaround sems to no longer work, I get a checksum error. Any idea ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants