How To Write Dynamic Migrations

Migrations are stored as configurations or in templates. When migrations are in config, they are confined to that particular use case only and it’s quite complex to dynamically change runtime behavior or it to retain execution context. Do you know how are Drupal 7 to Drupal 8 migrations generated? The answer is “Derivers.”

A simple use case of importing multilingual content from multiple CSV files can easily be handled by specifying migration templates which would dynamically generate migrations.

We’ll go through:

  • How migration works in Drupal 8

  • Migration templates and to migrations as config

  • Brief understanding of migration plugins

  • How to write Derivers for your migration use case(s)?

  • How we can execute migrations which are derived from Derivers?