hook_schema install, but not uninstall I can't figure how it is possible that the table I define in a hook_schema is created when I enable my module, but it isn't deleted when I uninstall the module (after disabling).

Drupal 7 documentation sais that the table should be automatically created and deleted when these events occours.

Here is the relevant part of the code inside my_module.install:

function my_module_schema(){
    $schema = array();
    $schema["my_module_table_xyz"] = array(
            ...
    );
    return $schema;
}


I don't know if it could be related to the difference between the modue name and the table name... or from the code present in the hook_uninstall... or something else...

Considering I also define a node type, the hook_uninstall should delete it (see following code), then system should automatically uninstall previously defined schema.

function my_module_uninstall(){
    ...
    node_delete_multiple(...);
    // delete custom fields
    node_type_delete(...);
    field_purge_batch(...);
}


What do you think about?
Thanks

NOTE: I use Drush to disable, uninstall and reinstall the module and I get the error Table my_module_table_xyz already exist.



Update: I just verified that the same code in a clean Drupal installation works as expected (table defined in hook_schema have been successfully removed).

In the "problematic" Drupal installation I also tried to explicit run drupal_uninstall_schema("my_module_table_xyz") at the end of the hook_uninstall (and I inserted a log instruction just after that line, to verify it runs without breaking), but nothing change. The table is stille there!

Any idea/hypothesis about will be really appreciated.
I had the same issue and finally I just manually did it in hook_uninstall(), I could find no other recourse.

function mymodule_uninstall() {
  $table_name = 'mytable';
  if (db_table_exists($table_name)) {
    db_drop_table($table_name);
  }
}


Hope this saves someone else some time.