In certain circumstances, installation of the Media module can fail with the following error:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydatabase.media_type' doesn't exist
Splitting this off from as that was really a separate issue.
One trigger for this issue is when a module calls API methods in a default hook implementation. An example is in
The current patch in this issue, in #13, adds an explicit test for
db_table_exists(). This change prevents the error, but there are outstanding questions as to whether this is the correct fix.
While this error appears in Media, its solution may properly lie elsewhere. It would seem unreasonable to expect that every hook implementation should test to ensure its module's tables are in place in case it's incorrectly invoked by another module before it's completed installation. Perhaps the onus to address/avoid premature data calls should be on modules invoking API calls from within default hook implementations.
is an issue on Drupal core that attempts to diagnose and address the causes of this bug.
User interface changes
|PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).|
|FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch patch-to-module_enable-for-profile-installation_0.patch. Unable to apply patch. See the log in the details link for more information.|
|PASSED: [[SimpleTest]]: [MySQL] 26 pass(es).|