Setting the migration database in Drupal 8

140 views Asked by At

Having a nightmare of a time trying to create Drupal7 to 8 migrations. The error I keep running into is:

Table "newdrupal8database.migrate_map_d7_taxonomy_vocabulary" doesn't exist.

I've tried a few different methods of attempting to set the correct database, such as setting it in the modules vocabulary.yml under source > key. And also setting a "key" within the Vocabulary.php source file in the docblock.

What's also strange is the database name it's looking for wouldn't even be correct if it were selecting the default. It's removing the hyphens from the db which would actually be "new-drupal-8-database". I'm also confused as to why it's looking for a table named "d7_taxonomy_vocabulary" since I've renamed all instances of "d7" in my module with "modulename".

What makes it even more difficult to debug is it appears I need to run the following commands every time I need to make a change and test this out:

drush php
Drupal::configFactory()->getEditable('migrate.migration.modulename_taxonomy_vocabulary')->delete();
exit
drush pm-uninstall modulename -y && drush en modulename -y
drush mi --all

Just to clear everything and re-attempt the import. Only to get the same sql error again. Loosing my mind and would love some help as the few resources online are either too vague or outdated

1

There are 1 answers

0
kilrizzy On

Alrighty, so after a ton of trial and error I at least was able to get two imports to run successfully so far. Figured I'd post my solution in case anyone has the same issue and want to try it.

  • I copied my default database to one without hyphens. Somewhere drupal was stripping these out, so just copied everything to a db with no hypens

  • While trying different filenames, I made my migration names "migrate.migration.module_taxonomy_vocabulary.yml", when they needed to be prefixed with "migrate_plus" instead, ie: "migrate_plus.migration.module_taxonomy_vocabulary.yml"

Good luck to anyone who needs to do this, it sucks.