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: oc_migrations already exists #2227

Closed
UltraBlackLinux opened this issue May 26, 2024 · 1 comment
Closed

upgrade: oc_migrations already exists #2227

UltraBlackLinux opened this issue May 26, 2024 · 1 comment
Labels
needs info Additional info needed to triage

Comments

@UltraBlackLinux
Copy link

UltraBlackLinux commented May 26, 2024

I just tried to upgrade nextcloud trying to get a fix applied:

[+] Running 2/2
 ✔ Container nextcloud                  Created                                                                                                          0.0s
Attaching to nextcloud
nextcloud  | Configuring Redis as session handler
nextcloud  | Initializing nextcloud 29.0.0.19 ...
nextcloud  | Can't start Nextcloud because upgrading from 27.1.1.0 to 29.0.0.19 is not supported.
nextcloud  | It is only possible to upgrade one major version at a time. For example, if you want to upgrade from version 14 to 16, you will have to upgrade from version 14 to 15, then from 15 to 16.
nextcloud exited with code 0

then I downgraded the container one version and tried again:

[+] Running 1/1
 ✔ Container nextcloud  Recreated                                                                                                                        0.1s
Attaching to nextcloud
nextcloud  | Configuring Redis as session handler
nextcloud  | Initializing nextcloud 28.0.5.1 ...
nextcloud  | Upgrading nextcloud from 27.1.1.0 ...
nextcloud  | => Searching for scripts (*.sh) to run, located in the folder: /docker-entrypoint-hooks.d/pre-upgrade
nextcloud  | Nextcloud or one of the apps require upgrade - only a limited number of commands are available
nextcloud  | You may use your browser or the occ upgrade command to do the upgrade
nextcloud  | Setting log level to debug
nextcloud  | Turned on maintenance mode
nextcloud  | Updating database schema
nextcloud  | Doctrine\DBAL\Exception\TableExistsException: An exception occurred while executing a query: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'oc_migrations' already exists
nextcloud  | Update failed
nextcloud  | Maintenance mode is kept active
nextcloud  | Resetting log level
nextcloud exited with code 0

and now nextcloud is no longer accessible and I have no idea what to do, and I need it working as soon as possible :/

Edit: After trying several times to make it accept my backup, which all ended up booting into maintenance mode anyway, I don't think this is properly salvageable

@joshtrichards
Copy link
Member

joshtrichards commented May 31, 2024

Sorry to hear you ran into difficulties.

You should be able to start with a clean set of volumes, return to your original image, and restore your database + config from a backup,

I'm unclear what originally occurred. The moment the 29 image boots it checks and aborts (as you saw) if the major versions aren't reasonable for an upgrade to occur. So the 29 container start alone wouldn't touch your existing db.

27.1.1 is fairly old. Nextcloud suggests upgrading to then current latest maintenance release in a given major before upgrading to a new major release. Part of the reason for that is to make sure all previous db changes (migrations) have been applied before upgrading. It's possible you encountered something related to that.

https://docs.nextcloud.com/server/latest/admin_manual/maintenance/upgrade.html

You might find help at the community help forum: https://help.nextcloud.com

@joshtrichards joshtrichards added the needs info Additional info needed to triage label May 31, 2024
@joshtrichards joshtrichards closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info Additional info needed to triage
Projects
None yet
Development

No branches or pull requests

2 participants