Provide a way to remove migration tables (ID map etc.)

Created on 26 April 2016, over 8 years ago
Updated 28 September 2023, about 1 year ago

Problem/Motivation

The 3 modules Migrate, Migrate_drupal, Migrate_drupal_ui didn't implement any method to remove these tables or other data related to migration and have no use after complete migration.

After uninstall of migration modules the tables created are not removed. It is not reasonable to not have a mechanism to remove these tables.

Why are these tables left after uninstall of the migration modules
Since this is frequently asked, here is a summary.
The tables remain after the migration because they provide the necessary information to fix problems that may discovered later, even after initial testing of the migration results. It is completely up to you to choose when to remove the migrate tables. But do so with the knowledge that if problems appear later and are traced back to the migration, it will be very difficult, if possible at all, to fix. See #11 and #22

Proposed resolution

Create form to delete migration tables both those with a current migration and those without a migration.
Use the existing destroy method on id_map/Sql.php.
Add a menu item at admin/reports

Listing page - No message tables

Listing page - two tables

Confirm page:

Success message:

New documentation page - https://www.drupal.org/docs/upgrading-drupal/after-the-upgrade

Remaining tasks

Reviews
#44

User interface changes

New form to list and delete migrate tables.

API changes

Data model changes

Release notes snippet

Feature request
Status

Needs work

Version

11.0 🔥

Component
Migration 

Last updated 3 days ago

Created by

🇪🇬Egypt mhmd Riydah

Live updates comments and jobs are added and updated live.
  • Needs usability review

    Used to alert the usability topic maintainer(s) that an issue significantly affects (or has the potential to affect) the usability of Drupal, and their signoff is needed. When adding this tag, make it easy to review the issue. Make sure the issue summary describes the problem and the proposed solution. Screenshots usually help a lot! To get sign-off on issues with the "Needs usability review" tag, post about them in the #ux channel on Drupal Slack, and/or attend a UX meeting to demo the patch and get direct feedback from designers/UX folks/product management on next steps. If an issue represents a significant new feature, UI change, or change to the general "user experience" of Drupal, use Needs product manager review instead. See the scope of responsibilities for product managers.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇿New Zealand quietone

    The patch still applies.

    I am setting to Needs Review and noting that @benjifisher commented in #44 Provide a way to remove migration tables (ID map etc.) Needs work that he was going to add some more suggestions. Still, others can add reviews if they wish.

  • For those who do migrations via Drush, adding a Drush command to remove a migration table might be helpful. Otherwise, it is always possible to execute a DROP TABLE command in SQL via Drush.

  • 🇮🇳India bhanu951

    For anyone who want to drop all migrate tables in one go, here is a command to do it

    drush sqlq --extra='-ss' "show tables like 'migrate_%'" | sed -r '/^\s*$/d' | while read TABLE ; do echo "drush sqlq 'DROP TABLE $TABLE;'" ; done
    

    credits to @xurizaemon on slack

    This command is dangerous and use it only if you know what you are doing. IT WILL DROP ALL MIGRATE TABLES.

  • last update about 1 year ago
    30,370 pass
  • Status changed to Needs work about 1 year ago
  • 🇺🇸United States mikelutz Michigan, USA

    Moving this back to NW, as it definitely needs some work. I'm also not sold on putting this in the migrate module. I feel like for core, We should add an option in migrate drupal UI to remove tables when done. We might also add a drush command to the core migrate drush commands to remove the tables. As far as a UX like this to remove all migration tables, I think it should live in migrate_tools. I'm hesitant to add any UX to the api module directly, I'm a fan of keeping that purely api. Outside of the migrate_drupal_ui, the migrate api requires migrations to be run through drush, migrate_tools UX, or custom code, and I feel like those are the places where table removal should happen. The api module should only provide an api method of removing the tables, which it does through MigrateIdMapInterface::destroy()

Production build 0.71.5 2024