phpsymfonydoctrinesymfony4doctrine-migrations

Symfony 4.4. Run migrations after bundle install


I try to create a Bundle for Symfony 4.4 which must contain its own migrations. How can I create doctrine migrations and enable them in the project? Does it's possible to run doctrine:shema:update with bundle migrations after install the bundle?


Solution

  • In Symfony 4.4 there is no more bundle, it's deprecated. However, if you really need to work with bundle, look at https://symfony.com/doc/current/bundles/DoctrineMigrationsBundle/index.html#configuration In your configuration:

    doctrine_migrations:
        # List of namespace/path pairs to search for migrations, at least one required
        migrations_paths:
            'App\Migrations': '%kernel.project_dir%/src/App'
            'AnotherApp\Migrations': '/path/to/other/migrations'
            'SomeBundle\Migrations': '@SomeBundle/Migrations'