I can't seem to dig myself out from a variety of errors concerning styles installation. I'm trying to install the latest dev version (but this was the same error I was receiving with older dev versions a month ago.)

[code]PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'site.styles' doesn't exist: SELECT styles.* FROM {styles} styles ORDER BY name ASC; Array ( ) in styles_default_styles() (line 233 of /var/www/sites/all/modules/styles/styles.module).[/code]

I see there is a patch for something similar, but it is already rolled into the current version. I guess what I really need to figure out is how to actually remove styles so I can install it.

Any help would be appreciated.

Comments

bacchus101’s picture

Still stuck. I've tried going through the database and removing anything associated with styles, but I am still getting the above error when I try to re-install.

bacchus101’s picture

Actually, now I just get "The website encountered an unexpected error. Please try again later" as soon as I try to enable Styles.

I've also tried un-installing File Styles, Styles UI and Styles, but apache throws a 500 error.

This happens with both the current dev and alpha versions.

bacchus101’s picture

bacchus101’s picture

I'm at the latest dev version (Feb 25th.) I'm still getting the exact same message when attempting to install:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'site.styles' doesn't exist: SELECT styles.* FROM {styles} styles ORDER BY name ASC; Array ( ) in styles_default_styles() (line 232 of /var/www/sites/all/modules/styles/styles.module).

leroyg’s picture

im geeting the same error and I don't have a clue what it means :-(

aaron’s picture

Status: Active » Postponed (maintainer needs more info)

please try going to the modules page, disabling styles (and any dependent modules), then go the uninstall tab and uninstall the modules. then finally reenable them and see what happens.

bacchus101’s picture

There is no way to uninstall the module as it does not show up in the uninstall list (File Styles and Styles UI do show up. Only File Styles can be removed. Attempting to remove Styles UI makes Apache throw a 500 error.)

There is no way to try and install the module, to uninstall it as it throws the PDOException.

damienmckenna’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new646 bytes

I believe this is the same problem as #1311828: Installation fails with SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.media_type' doesn't exist for Media.module, which stems from Drupal 7 running registry_update() during module_enable() in between it loads the styles.module file and actually runs styles_schema() and styles_install(); as a result it causing many other modules (like CTools) to reload certain data from hooks, which in this case causes styles_field_formatter_info() to run styles_default_styles() which tries to load data from a table which doesn't exist yet. Whether the finger ultimately needs to point to CTools, Drupal core or elsewhere, I don't know, but hopefully for now we can at least work around it.

This patch simply adds a check in styles_field_formatter_info() to see if the site is currently running an installation profile without having installed the {styles} table and returns an empty array if so.

damienmckenna’s picture

Title: PDOException: SQLSTATE » Installation fails with SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.styles' doesn't exist

Updating the title to be more clear.

nedjo’s picture

Status: Needs review » Needs work
StatusFileSize
new114.76 KB

Table name should be 'styles' rather than 'media_type'.

Here's a full backtrace for one instance of this error, which occurs when installing the Open Outreach distro. As with a parallel but in the media module queue, it's not clear that the hook implementation here should be responsible for testing to see if it's being called at an inappropriate point, before styles is installed. See comments in #1311828-26: Installation fails with SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.media_type' doesn't exist. Notably, this backtrace as well as the one for that issue includes a hook_views_default_views() implementation - in this case, calendar_views_default_views - invoking API methods that trigger hook invocations, leading to the error.

bluegeek9’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

Thank you for your contributions to this issue. As Drupal 7 has reached its End of Life and is no longer supported, we are closing this issue. We encourage you to upgrade to a supported version of Drupal.