Database Refreshing Pattern in Drupal 8 – Testing Config Changes

I’ve been working on some┬áDrupal 8 migration work. Given that most of the work I’m doing takes place in “config” I have to keep refreshing/reinstalling the config on my site. For a long time I would use Configuration Installer to pull in the changes I’ve made before repeatedly testing the migrations. The pattern is: Develop, overwrite config, test, develop, overwrite config, test.

Just recently, weeks into the migration work, I realized that there are certain things that aren’t working properly unless I do a full uninstall/reinstall of my custom migrate module, and then even still there are certain things that migrate holds onto that were causing my testing to be unpredictable. As a result I’ve moved back to the trusty pattern of “resetting”┬áthe entire database (pre-migration) between checks. I recognize that this won’t work if you have a huge database, but the set of commands takes less than 20 seconds to run on my machine, so it’s hardly an issue.

This would work for any Drupal development where you have to keep testing changes repeatedly. The simple approach is to get the database to where you want it (before the change you want to repeatedly test) and take a snapshot, then use this snapshot over and over again. It sounds really simple right? That’s because it is; there’s nothing new or earth-shattering here, folks.

Here are the commands with notes:


Leave a Reply

Your email address will not be published.