0

I find myself using Backup and Migrate's Restore (from manual backups folder) when testing module sets or after a change to a project is problematic. I use Schema after the restore to check for extra tables left in the database during the restore process. Generally, orphaned extra tables that are no longer wanted, needed or an issue are tables from modules or entity/content type fields being prototyped/tested. Module tables left in the database cause PDO Exception errors if I attempt to reinstall same module or alternate dev version after a restore. Extra field tables can get quite numerous and chaotic when rapid prototyping.

EXAMPLE Match (107) Hide Extra (11) Tables in the database that are not present in the schema. This indicates previously installed modules that are disabled but not un-installed or modules that do not use the Schema API.

Schema report looks like:

  • Match (107) Tables for which the schema and database agree.

  • Extra () Tables in the database that are not present in the schema. This indicates previously installed modules that are disabled but not un-installed or modules that do not use the Schema API.

    field_data_field_test_termsfruits   // fields for content types
    field_data_field_test_code_and_api
    field_data_field_test_drupal
    field_revision_test_termsfruits
    field_revision_test_terms_code_and_api
    field_revision_test_terms_drupal
    search_api_index                    // a module not being used
    search_api_item
    search_api_server
    search_api_task 
    

Seems that Backup and Migrate team is not ready to include drop tables options and the issue has been discussed in detail. I've also tried the Demonstration module which was great in D6 but just spits errors in D7 for me.

Aside from phpMyAdmin, MySQL GUI tools or command line to drop tables (and realizing security risk if permissions are compromised), what contributed modules or other PHP/API methods can I use from within the Drupal interface to drop specific tables?

0

As far as the API goes there's db_drop_table()

db_drop_table('table_name');
  • How could it be used with forms to make a modules that you could type in the table name(s) to drop? – Cymatical Jan 28 '14 at 19:19
  • I suppose that after restore, and after checking schema I can use a php block with that function. – Cymatical Feb 19 '15 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.