Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
What is the status of Rules migration to D8?
I have lots of rules that use VBOs and the Entity API for example. I would love to migrate these, but have not found much info on the migration status.
Comments
Comment #2
TR CreditAttribution: TR commentedRule configurations and Reaction rules both need migration paths from D6/D7 to D8 where they are now configuration entities.
Has any work been done on this? Is there a tracking issue or a meta issue which lays out the plan for providing this?
Comment #3
TR CreditAttribution: TR commentedApparently in D7 each reaction rule and each rule configuration is stored in the {rules_config} table as a serialized array.
Migrating the contents of this table to configs should be fairly easy. All that's required is a source plugin and two migration templates.
Anyone else interested in this?
Comment #4
giorgio79 CreditAttribution: giorgio79 commentedComment #5
TR CreditAttribution: TR commentedI've done a lot of work on this since my last post, and I have created non-comprehensive migrations for Reaction Rules. I don't have time to finish this off, but if you're interested and willing to complete and share the work, I'll post what code I have so far...
Comment #6
quietone CreditAttribution: quietone as a volunteer commented@TR please post what you have. I don't know rules but I do know migrate so may be able to assist.
Comment #7
TR CreditAttribution: TR commentedSure, it would be great to have your help! I'm out of town right now and don't have access to that code, but I'll find it and send it to you next week when I get back.
Comment #8
DamienMcKennaComment #9
brooke_heaton CreditAttribution: brooke_heaton as a volunteer commentedAny progress on this. Last update from TR was that they'd done a great deal of work. Would love to see something done to migrate from D7 to D8/9.
Comment #10
TR CreditAttribution: TR commentedFor my uses, it proved to be easier and quicker to just re-create the Rules on the new site. The migration code was mainly a huge table holding the old (D6/D7) event/condition/action machine names and the corresponding new (D8) event/condition/action machine names. And if you use any contributed Rules modules, like Rules Conditional etc., this will fail because Rules itself doesn't know about those contributed event/condition/actions and because none of those contributed modules has its own migration code. There's also a problem because a lot of people used executable PHP code in their conditions/actions in D6/D7, that that concept doesn't translate at all to D8. Likewise, the code for exposing custom data to Rules can't be automatically migrated. Then there's the issue of modules that used to rely on Rules in D7 but have abandoned Rules in D8 in favor of their own workflow code - trying to support the D7 -> D8 migration in these cases is impossible without the co-operation of the maintainers of those module, and that's not something I've been getting.
That's what I meant by "non-comprehensive" in the previous post. The big issue I had is that in order to get the migration to run, you have to have every case covered, and the number of those kept growing and growing even for sites that didn't make a lot of use of Rules because so many contributed modules with large user bases provided Rules support in D7 and those needed their own migrations in order for most Rules to be migrated. I saw that this was something I couldn't complete by myself for general use - there has been no support from the community and there has been no support in the issue queues for those contributed modules that support Rules. And I certainly don't want to be wasting time supporting this for those few who need it.
My solution, for the few sites where I actually had to re-implement the D7 site in D8, was to write a number of ad hoc scripts to export the D7 Rules then transform the JSON format into YAML format and then import those Rules into D8. Then hand-edit each Rule to make sure it was configured correctly, could be saved, and functioned correctly, and of course manually implement any data/events/conditions/actions from contributed modules that hadn't been ported to D8 yet. That last step was the greater part of the work.
Note that because configuration entities are now in core in D8, migrating Rules from D8->D8 (moving a site, for instance) or D8->D9 is now trivial and doesn't require any module-specific migration code. The only problem is with D6, D7 to D8 or D9, where it is IMO not worth the effort to write the migration for Rules.
For these reasons I'm going to mark this issue as "won't fix".
Comment #11
DamienMcKennaI think it would be really useful to add a documentation page explaining some of this, so other people trying to upgrade their sites might have some help instead of being left in the dark.
Comment #12
TR CreditAttribution: TR commentedYeah, I might get around to writing that documentation eventually, but there's still so much more to do and I'm focused on what are IMO way more important things. It would be really great if even a few of the 250,000 users of Rules would pitch in and write up some of this information with me having to do everything myself ...