Hello,
I work on a drupal 7 site where hundreds of taxonomy terms were migrated into a vocabulary a few years back. A custom module was created for this purpose and a static class was derived from the Migration class (meaning the constructor does not take any arguments). The source database table was created in the drupal database and is still available.
I would like to import additional taxonomy terms into the same vocabulary. Can I reuse this work by simply inserting my rows into the existing table and running $drush mi <migration_machine_name>
? In my local environment, I truncated the table and inserted a single row. The migration worked. However, because I’m running multiple migrations, I’m wondering if I should create a separate class to support dynamic migrations? I'll need to run another migration again in the near future. If I need to create a new class, I’ll change the source to use csv files like in migrate_baseball_example.
Thank you,
Ann
Comments
Comment #1
tenken CreditAttribution: tenken commentedWhy reuse the class as-is?
I recommend updating to the latest stable migrate module and then defining a new migration group for your new tasks. Then copy and fix your old class code to work with the newest migrate api and also make it use CSV data, in a new migration class.
Take the time to learn the current stable migrate api, learn to create a simple migration ... You'll grow as a developer and your site will be more maintainable.
Comment #2
mikeryanBy "multiple migrations" you just mean running the same migration multiple times, correct? All you have to do is add new content to the source table you originally used, then rerunning the migration will import that new content, no problem.
Comment #3
ann b CreditAttribution: ann b commented@mikeryan: Thank you, this worked perfectly. Yes, I just need to run the same migration multiple times. I wasn't sure if I needed to create a dynamic migration. I suggest the following small change to the first paragraph of the Dynamic migrations documentation page:
Thank you also @tenken. The need for additional migrations will arise in the near future, guaranteed. I will switch the new migrations to use the latest recommended version of the migrate module and CSV files as the source.
Comment #4
ann b CreditAttribution: ann b commentedComment #5
mikeryanThat page was obsolete, a relic of when DynamicMigration was a separate class and dealing with "dynamic" migrations was a special thing - I've now removed it so it won't cause further confusion. Now all migrations are "dynamic" and it doesn't need to be discussed separately, all the relevant information on how to register classes is at https://www.drupal.org/node/1824884.