Perform Doctrine Database Migration Function within Controller

I have installed doctrine/migrations ~3.4 and doctrine-orm-module ~5.1 via composer. I followed instructions to set a basic database migration from the following url: . I have successfully been able to generate a migration and perform the migration from the command line ( #> sh ./migrations generate ) ( #> sh ./migrations migrate )

My question is, how can I generate, and perform a migration from within a controller action?

I would like to create a view that shows me all the versions available, allows me to generate a new version, and by submitting a form, can move the database to the version selected. I do not want to do this on the command line, at least for these particular purposes.

I found an example here: Example 1, but I’m getting errors, indicating to me that this example was using an older version. I haven’t been able to translate it to the newest version for some time. Common errors:

use Doctrine\DBAL\Migrations\Migration cannot be resolved
$config->setMigrationsTableName(‘version’); unidentified function, doesn’t exist.

Any assistance would be appreciated.

For things like this, it is worth a shot checking out bigger, laminas-based projects and see how they do such things.
For example Omeka S: As far I can see, they wrote their own Migration Manager, which might be helpful to you.
For the initial installation, they seem to access a SQL file through an Installer.

Good luck, please do keep us posted :slight_smile: