My client wanted to change the theme on an existing Drupal 7x website and Media is one of the depended modules. After I installed Media 7x.1-5 I got several errors.

1) Installation fails with SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.media_type' doesn't exist

Which I resolved by importing the table from http://pastebin.com/cf4bBjjE

2) PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'databasename.media_filter_usage' doesn't exist

Which I resolved by importing another table according to #3 on https://www.drupal.org/node/2081695

3) Then I got the error PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mysite.image_dimensions' doesn't exist:

and I rolled back to Media 1.3 which I still had on my harddrive. It one of the solutions offered at https://www.drupal.org/node/2170231

But now I am getting white screens only, and I am not sure what to do next.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

javivf’s picture

Assigned: Unassigned » javivf
FileSize
566 bytes

I think this patch solve the issue, can you review it?

javivf’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: media.patch, failed testing.

David Hernández’s picture

+++ b/sites/all/modules/contrib/media/media.install
+++ b/sites/all/modules/contrib/media/media.install
@@ -349,7 +349,7 @@ function media_update_7002() {

@@ -349,7 +349,7 @@ function media_update_7002() {
     'primary key' => array('name'),
   );
 
-  db_create_table('media_type', $scheme['media_type']);
+  db_create_table('media_type', $schema['media_type']);
   drupal_load('module', 'media');

Instead of updating an existing hook_update_X, I think it will be better to create a new update_X function. Because the people who has already executed the update, will not resolve the issue after updating or applying the patch.

javivf’s picture

Version: 7.x-1.5 » 7.x-1.x-dev
Status: Needs work » Needs review
FileSize
2.38 KB

Done changes as suggested

David Hernández’s picture

Assigned: javivf » Unassigned
Status: Needs review » Reviewed & tested by the community

Everything looks correct from here.

Still, I don't feel like this is a nice solution. But at least it works. Let's wait for the maintainer to give a final veredict about this.

There is only a little problem, but is not important:

+++ b/media.install
@@ -706,3 +706,62 @@ function media_update_7020() {
\ No newline at end of file

Missing newline at the end of the file.

Dave Reid’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
0 bytes

Revised and cleaned up, allowing us to re-use the existing update hook function.

Dave Reid’s picture

FileSize
1.17 KB
Dave Reid’s picture

Status: Needs review » Fixed

Committed #8 to 7.x-1.x.

  • Dave Reid committed 70a089e on 7.x-1.x
    Issue #2473203 by javivf, Dave Reid: Fixed spelling error in...
Dave Reid’s picture

Also added the update hook to 7.x-2.x, just in case.

  • Dave Reid committed cf26857 on 7.x-2.x
    Issue #2473203 by javivf, Dave Reid: Fixed spelling error in...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.