Issue Bug Closed

#106084TYPO3 Upgrade Wizard marked as done before it can ever run

Daniel Siepmann 02/05/25, 07:42 updated 11/13/26, 09:56

Description

The Upgrade Wizard SysFileCollectionIdentifierMigration with identifier sysFileCollectionIdentifierMigration can never be executed when updating from v11 to v13.
This is as the TYPO3 code first calls updateNecessary() on the wizard before checking the getPrerequisites()

The wizard will report no update is necessary, as the new field to migrate to does not exist yet.
The wizard will be marked as done, and never be executed again.

I would expect the UpgradeWizardRunCommand to check the prerequisites before calling any other code on the wizards.
But if it is intended, this should be documented, and the wizard needs to be changed to also run if any column is missing. That way the pre conditions will be evaluated and ensured prior executing the wizard.

Current workaround is to manually run database:updateschema before, to add new columns, but not delete any columns.

Related documentation: https://docs.typo3.org/m/typo3/reference-coreapi/13.4/en-us/ExtensionArchitecture/HowTo/UpdateExtensions/UpdateWizards/Creation.html
This does not explain anything about my assumptions and should probably be improved to clearly state how to use updateNecessary() and what to expect, e.g. whether the preconditions will be met before, or between checking and execution.

Steps to reproduce:
- Install v13
- import attached dump
- execute ./vendor/bin/typo3 upgrade:run -vvv;

Or manually:
- Create a database from TYPO3 v11
- Create one db row within sys_file_collection
- Switch to v13
- execute ./vendor/bin/typo3 upgrade:run -vvv;

I didn’t test in v12 where the wizard was added, but it might be an issue there as well.
I also couldn’t find a proper Category related to the wizard.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Files 1

History 9

  1. Oliver Bartsch commented <span data-processor="relativetime" data-value="2025-03-03T08:54:28+00:00" > 03/03/25, 08:54 </span>

    Hi Daniel, actually it’s documented that before running any upgrade wizard, the database needs to be updated for new tables and columns. See for example the documentation for the GUI https://docs.typo3.org/permalink/t3coreapi:run-upgrade-wizard. So to me, it’s the intended behavior.

  2. Daniel Siepmann commented <span data-processor="relativetime" data-value="2025-03-25T05:47:45+00:00" > 03/25/25, 05:47 </span>

    Hi Oliver,

    can you elaborate what’s the reason behind getPrerequisites() than?
    From my point of view the behaviour of the system related to this method is either broken, or the PHPDoc comments are misleading.

    I understand your comment that it is correct to explicitly run database migrations beforehand. But the check for prerequisites marks the wizard as done if they are not met.

  3. Benni Mack commented and changed status Needs Feedback Closed <span data-processor="relativetime" data-value="2026-11-13T09:55:19+00:00" > 11/13/26, 09:55 </span>

    Hi Daniel,

    getPrerequisites() lists what a wizard needs in order to run, not what it needs to decide whether it has to run. The order is on purpose: updateNecessary() is called first, and only for the wizards that return true are the prerequisites collected and made sure of before executeUpdate(). That way, a run where nothing needs migrating doesn’t touch the database schema.

    So updateNecessary() must only look at the old data. It must not depend on structure the prerequisites would create, such as a new column. A wizard that returns false because its target column doesn’t exist yet is broken, and should be fixed in that wizard. The runner is fine.

    Agreed that this needs to be in the docs. The “Creating upgrade wizards” page should say that updateNecessary() is called before prerequisites are made sure of.