Domanda

I inherited a Drupal 7 site that appears to have a history.

I'm receiving the following error when updating modules or clearing the cache:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'website_staging.search_api_server' doesn't exist: SELECT base.id AS id, base.name AS name, base.machine_name AS machine_name, base.description AS description, base.class AS class, base.options AS options, base.enabled AS enabled, base.status AS status, base.module AS module FROM {search_api_server} base WHERE (base.status IN (:db_condition_placeholder_0, :db_condition_placeholder_1, :db_condition_placeholder_2)) ; Array ( [:db_condition_placeholder_0] => 3 [:db_condition_placeholder_1] => 2 [:db_condition_placeholder_2] => 6 ) in EntityAPIController->query() (line 187 of /home/website/apps/api/docroot/sites/all/modules/entity/includes/entity.controller.inc).

The question is: where in the database do I need to remove any and all traces that point to this table?

Background:

I figured this was just a module that somehow did not install its tables right somehow. Uninstall, reinstall and done, right?

Two problems:

  1. Uninstalling a module also yields this error, and does not work
  2. The Search API module (http://drupal.org/project/search_api) never was installed at all

It appears the previous developers created a custom module, and named it 'search_api'. My guess is that later they went and did a blanket update of the site modules using drush, and starting updating the custom module far enough to install something to the database. Then they realized their mistake, and replaced the custom module in its original location (but did not rename it).

Nowhere in my modules is there a pointer to the search_api_server table, so it must be somewhere in the database.

So my plan as it stands is:

  1. Somehow fix the error
  2. Uninstall the custom search_api module
  3. Rename the custom search_api module and reinstall

And I need some help with step 1

È stato utile?

Soluzione

I second the voices above.

My recent experience to get out of the pdoexception is crude and more akin to a 'big hammer' rather than anything elegant.

  1. make a backup of your database and the code
  2. either use a UI like phpmyadmin OR sql if you feel more comfortable with code
  3. create the table it says is missing (website_staging.search_api_server)
  4. add at least 1 variable (id)... take the defaults of integer
  5. you don't have to add a value to the table, just create it and add the definition for the id variable
  6. try your uninstall again

In my case for my custom module practice development, I also had to add a second variable because there were two 'keys' on the table. But I'd try this with just the one variable (id)... hopefully it will be enough to get you out of the PDOexception and onward to module/code review.

The concept here is to give Drupal the minimum info it needs via manual PHP/SQL creation so it can 'connect the dots' and move forward to execute your commands (uninstall). JW

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a drupal.stackexchange
scroll top