Typical extension installation involves uploading extension files and clearing Magento cache. Under certain circumstances, extension does not get installed, and Magento starts reporting (in var/report directory, by email, or on screen, depending on the settings) errors like "Base table or view not found", "Column not found" or "Index not found".

In this article, we examine why it happens, how to avoid it and how to fix it.

How to fix

If you are reading this article good chances are that you already getting one of the errors listed above and looking for solution.

Here it is:

  1. Let Magento think the extension is not installed.
  2. As extension can be half-installed into database (see below), throw away that half-installed database tables.
  3. Let Magento install the extension anew.

For step 1 and step 2, you need to run SQL script on your database using database administration tool of preference (typically, phpMyAdmin). This SQL script (referred here as uninstallation script) differs from extension to extension, see below.

For step 3, you need to refresh Magento cache and refresh any frontend or backend Magento page.

So, in short, run the script and refresh Magento cache.

Uninstallation script for any of the extensions from Layered Navigation series including SEO Layered Navigation Plus

DELETE FROM `eav_entity_type` WHERE `entity_type_code` = 'm_filter';

DROP TABLE IF EXISTS `m_filter_int`;

DROP TABLE IF EXISTS `m_filter_varchar`;

DROP TABLE IF EXISTS `m_filter_datetime`;

DROP TABLE IF EXISTS `m_filter_decimal`;

DROP TABLE IF EXISTS `m_filter_text`;

DROP TABLE IF EXISTS `m_filter`;

DROP TABLE IF EXISTS `m_attribute`;

DROP TABLE IF EXISTS `m_db`;

DROP TABLE IF EXISTS `m_db_log`;

DROP TABLE IF EXISTS `m_filter2_value_store`;

DROP TABLE IF EXISTS `m_filter2_value`;

DROP TABLE IF EXISTS `m_filter2_store`;

DROP TABLE IF EXISTS `m_filter2`;

DROP TABLE IF EXISTS `m_seo_url_history`;

DROP TABLE IF EXISTS `m_seo_url`;

DROP TABLE IF EXISTS `m_seo_url_conflict`;

DROP TABLE IF EXISTS `m_seo_schema_store_flat`;

DROP TABLE IF EXISTS `m_seo_schema_store`;

DROP TABLE IF EXISTS `m_seo_schema_flat`;

DROP TABLE IF EXISTS `m_seo_schema`;

DROP TABLE IF EXISTS `m_edit_session`;

DELETE FROM `core_resource` WHERE `code` = 'mana_core_setup';

DELETE FROM `core_resource` WHERE `code` = 'mana_db_setup';

DELETE FROM `core_resource` WHERE `code` = 'mana_seo_setup';

DELETE FROM `core_resource` WHERE `code` = 'mana_filters_setup';

DELETE FROM `core_resource` WHERE `code` = 'manapro_filteradmin_setup';

DELETE FROM `core_resource` WHERE `code` = 'manapro_filtershowmore_setup';

DELETE FROM `core_resource` WHERE `code` = 'manapro_filtersuperslider_setup';

DELETE FROM `core_resource` WHERE `code` = 'manapro_filtercolors_setup';

DELETE FROM `core_resource` WHERE `code` = 'manapro_filterexpandcollapse_setup';

DELETE FROM `core_resource` WHERE `code` = 'manapro_filterhelp_setup';

DELETE FROM `core_resource` WHERE `code` = 'manapro_filterpositioning_setup';

DELETE FROM `core_resource` WHERE `code` = 'manapro_filterseolinks_setup';

Why it happens and how to avoid

At the core of the problem are extension installation scripts, which can be partly or entirely skipped by Magento during installation process. Most typical reasons why it happens:

  1. Magento Compilation feature (System->Tools->Compilation) is enabled during installation. In this case Magento runs all PHP code from includes/src directory and totally ignores all changes in app/code directory where extension is being installed. So, do disable Magento Compilation feature before installing the extension.
  2. Magento Cache (System->Cache Management) is disabled and you or other user loaded/refreshed any page in Magento frontend and backend during extension upload process. In this case during page request processing finds out that new extension is present and not installed and starts installing it while not all files are copied. So, do use Magento Cache.
  3. In all other cases the extension is installed while Magento refreshes the cache on your request. However even in this case there is a chance that while Magento is installing the extension on your request, some other user may request other page and Magento can start installing the same extension second or third time (due to lack of locking in installation script handling). The heavier the load, the more change it can happen. So in production enviroments with medium to high load, do take the site offline while installing the extension

Final words

If database error is on your screen, do not panic. The world is not ended. Follow the steps above and evrything will be OK.

If you have seen such an error, there is high change you will not. Even then, you always feel better when you do have a backup (both database and files).