orchardcmsorchardcms-1.9

In what order are migrations executed in Orchard?


I have a habit of keeping a separate Migration Class for every custom Type or Part. A lot of the time I want to attach a Taxonomy Field for the same Taxonomy to several custom Parts. Since I'm not sure which migration will run first, I have to check if the Taxonomy already exists in each migration and create it if it doesn't, leading to a lot of duplicate code. I could move my code into a service for the sake of re-usability/maintainability but it would be easier still if I knew for sure which migration was going to get executed first.


Solution

  • They should be running in order of dependency, starting with the dependency, ending with the module depending on it.

    However, for this sort of thing, you might want to try recipes rather than migrations.