Symfony 4.4安装包后运行迁移

问题描述

我尝试为 Symfony 4.4 创建一个 Bundle,它必须包含自己的迁移。 我如何创建学说迁移并在项目中启用它们? 安装包后是否可以使用包迁移运行 doctrine:shema:update

解决方法

在 Symfony 4.4 中没有更多的 bundle,它已被弃用。但是,如果您确实需要使用 bundle,请查看 https://symfony.com/doc/current/bundles/DoctrineMigrationsBundle/index.html#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'