Please test these thoroughly and/or export the list of tables to drop to a list then write a tidy update hook rather than blowing away data you didn't mean to.
It's a safer idea to write an update hook or export a list of tables to target because it may not be a fair assumption that every table named migrate_*
is one you can delete without impact. That's why the core functionality proposed uses a scan for known migrations rather than just deleting tables based on a pattern match.
That said, here are some quick solutions:
/**
* Clean up Migrate tables
*/
function example_update_8001() {
$database = \Drupal::database();
if ($migrate_tables = $database->schema()->findTables('migrate_%')) {
foreach ($migrate_tables as $table) {
$database->schema()->dropTable($table);
}
}
}
drush sqlq '\dt migrate_*' | awk '{ print $2 }' | while read TABLE ; do
echo "Dropping $TABLE" && drush sqlq "DROP TABLE $TABLE"
done
drush sqlq "show tables like 'migrate_%'" | while read TABLE ; do
echo "Dropping $TABLE" && drush sqlq "DROP TABLE $TABLE"
done