orocommerce

Custom bundle migrations fail at first install because they run before OroCommerce's installers


I created a custom bundle in which I have a few migrations, among them is one that adds a field to the Product entity, making the oro_product table a dependency for this migration to run.

The problem is that when I run the oro:install command, it runs the migrations, but fails at the beginning because it runs my custom bundle's migrations first, and that won't work because the oro_product table doesn't exist at this point in time.

Is there a way to control in which order the migrations are executed, or is there something else to do to avoid this issue?

Thanks!


Solution

  • To load the schema migration later, you can set the higher bundle priority in the <BundleDirectory>/Resources/config/oro/bundles.yml file. E.g.:

    bundles:
        - { name: Acme\Bundle\DemoBundle\AcmeDemoBundle, priority: 1000 }