4

I did something really stupid: I deleted the taxonomy_forum field (Forums) from the content type. Now I'm get all sorts of errors.

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'flo1121202154643.field_data_taxonomy_forums' doesn't exist:
SELECT field_data_taxonomy_forums0.entity_type AS entity_type, field_data_taxonomy_forums0.entity_id AS entity_id, field_data_taxonomy_forums0.revision_id AS revision_id, field_data_taxonomy_forums0.bundle AS bundle FROM {field_data_taxonomy_forums} field_data_taxonomy_forums0 WHERE (field_data_taxonomy_forums0.deleted = :db_condition_placeholder_0) AND (field_data_taxonomy_forums0.bundle = ..........

How do I reinstall the Forum module in Drupal 7 from scratch (including recreating the database schema)?

0

2 Answers 2

4

To uninstall a module, you follow these steps:

  1. Deselect the checkbox shown for the module in admin/modules, and click on the "Save configuration" button at the bottom of the page
  2. Select the "Uninstall" tab (admin/modules/uninstall), and in that page select the checkbox shown close to the name of the module you want to uninstall ("Forum")
  3. Click on the "Uninstall" button
  4. In the next page, click again on "Uninstall"

When you execute the first two steps, you are only disabling the module, which is not yet uninstalled. It is when you execute the last two steps that you uninstall the module.

To re-install it, you need to:

  1. Return to the page listing all the modules (admin/modules)
  2. Select the checkbox shown for the module you want to install ("Forum")
  3. Click on the "Save configuration" button at the bottom of the page

Uninstalling a module should already clear the cache, but to be sure you can manually clear the cache before to re-install the module.
Once the module is uninstalled, installing it back will let Drupal create the database tables used by the module again. The same tables are deleted from Drupal when the module is uninstalled.

I noticed a little issue that happens when you uninstall and re-install the Forum module: The default taxonomy term used by the module is created again all the times you re-install the module, and it seems it is not removed when the module is uninstalled. This is the result of uninstalling and re-installing the module more than once; each time the taxonomy term is created, even if it was already present.

screenshot

Actually, it is not even required to uninstall, and re-install the module; it is enough you disable, and then re-enable the module, as the code that creates the missing field is not contained in forum_install(), but in forum_enable(), which the function executed when the module is enabled.

I was going to suggest a different way to resolve this issue, and which consisted in manually creating the missing field, but I noticed it doesn't work. The problem is that the module that allows to create a field through the user interface always add "field_" at the beginning of the field names for the fields you create, but the field created from the Forum module doesn't have that prefix; the result is that some database tables and a field present in a table don't have the name the module is expecting, and the module throws errors.

0

Uninstall the Forum module and clear all cache, then install forum module make the same content type with same fields and add some data into it. Now try over with Views, and see if it is working or not.

2
  • How do I reinstall the Forum module? I am also getting this message: Warning: Cannot modify header information - headers already sent by (output started at /home/content/47/8059047/html/test2/includes/common.inc:2565) in drupal_send_headers() (line 1039 of /home/content/47/8059047/html/test2/includes/bootstrap.inc).
    – John
    Commented Nov 5, 2011 at 12:55
  • I deleted the view and cleared the cache. This made all of the errors go away! I've disabled and uninstalled the Forum module. How do I reinstall? Will that recreate the table?
    – John
    Commented Nov 5, 2011 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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