Module does not cleanly uninstall

Created on 23 January 2025, 3 months ago

Problem/Motivation

The ERD module does not properly clean up its state data during uninstallation. The module stores diagram state in the State API under 'erd.graph', but this data persists in the database after module uninstallation since there was no uninstall hook to remove it.

Steps to reproduce

1. Install the ERD module
2. Create and save an entity relationship diagram
3. Uninstall the module
4. Check the key_value table in the database - the 'erd.graph' state data remains

Proposed resolution

Add an erd.install file with hook_uninstall() to properly clean up the module's state data:

<?php

/**
 * @file
 * Install, update and uninstall functions for the ERD module.
 */

/**
 * Implements hook_uninstall().
 */
function erd_uninstall() {
  \Drupal::state()->delete('erd.graph');
}

Remaining tasks

1. Review and test the proposed fix
2. Commit the new erd.install file

User interface changes

None

API changes

None

Data model changes

The fix ensures proper cleanup of state data during module uninstallation. No changes to the data model itself.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Dave Kopecek

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

Comments & Activities

Production build 0.71.5 2024