Uninstalling migrate_drupal_ui Does Not Remove Stored Migration Credentials From the Database

Created on 22 July 2021, over 3 years ago
Updated 2 March 2025, about 1 month ago

Problem/Motivation

migrate_drupal_ui migration credentials are stored in as a key_value pair in the database. However, uninstalling the migrate_drupal_ui module does not delete these key_value pairs from the database. This can cause issues when a user may not want to use the migrate_drupal_ui and instead would prefer to run migrations via command line as the command line migrations are still using the previous credentials.

Steps to reproduce

  1. install and set up migrate_drupal_ui
  2. verify the contents of the `migrate_drupal_7` row in the key_value table
  3. uninstall migrate_drupal_ui
  4. verify the contents of the `migrate_drupal_7` row in the key_value table
  5. in settings.php, set up migration credentials with different values (different host or user for example)
  6. attempt to run migration via command line, migration will attempt to use credentials from `migrate_drupal_7` row in the key_value table, rather than settings.php

Proposed resolution

When migrate_drupal_ui is uninstalled, key_value pairs should be removed

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

migration system

Created by

πŸ‡ΊπŸ‡ΈUnited States thhafner Chicago, IL

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

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

  • First commit to issue fork.
  • Merge request !11341Delete state keys on uninstall β†’ (Open) created by dcam
  • Pipeline finished with Failed
    about 1 month ago
    #437796
  • πŸ‡ΊπŸ‡ΈUnited States dcam

    I verified that this is still an issue. But not quite for the reasons originally reported. The relevant state keys are created by the migrate_drupal module, not migrate_drupal_ui. It's natural that the state keys would still be in the database if migrate_drupal_ui is uninstalled and migrate_drupal is not. But migrate_drupal doesn't remove them either, which probably isn't a good thing for security. In any case, a module should clean up its stuff when being uninstalled.

    It's easy enough to update the module to remove those state keys on uninstall and to create a test for it. But this issue suggests that there are sites out there with orphaned state keys. I have no idea how those should be handled. If there's a precedent, then let me know.

    Since the Drupal migration modules are being removed for D12, then I think this issue should be handled before then. That way, anyone who still has migrate_drupal installed on their site will have the keys removed properly.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 310s
    #437801
  • Pipeline finished with Success
    about 1 month ago
    #437802
  • πŸ‡ΊπŸ‡ΈUnited States dcam
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Seems pretty straight forward

    Ran the test-only pipeline

    1) Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalUninstallTest::testUninstall
    Failed asserting that Array &0 [
        'key' => 'upgrade',
        'database' => Array &1 [],
    ] is null.
    /builds/issue/drupal-3224907/core/modules/migrate_drupal/tests/src/Kernel/MigrateDrupalUninstallTest.php:38
    

    Which what would be expected.

    LGTM

Production build 0.71.5 2024