Hi

The update of my site with its many modules from D6.22 to D7.10 is largely going well, but there are some few hiccups like the error involving the updates:

6200 - Rename permission "administer all guestbooks" to "moderate all guestbooks".
6201 - Add default value for {guestbook}.anon columns.

It fails with this error message:

guestbook module
Update #6200

    Failed: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'que1_orbit.permission' doesn't exist: SELECT rid, perm FROM {permission} ORDER BY rid; Array ( ) in guestbook_update_6200() (line 50 of /home/que1/public_html/abc/sites/default/modules/guestbook/guestbook.install).

Is there any way to solve this? I'm not coder/have no mysql db experience & so would appreciate a complete code/query solution. ;)

Thank you in advance

Comments

eric_a’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev
Category: bug » support
Status: Active » Closed (works as designed)

6200 - Rename permission "administer all guestbooks" to "moderate all guestbooks".
6201 - Add default value for {guestbook}.anon columns.

All D6 updates should be completed in your D6-site before even thinking about starting an upgrade to D7...

lionheart8’s picture

Hi

All D6 updates should be completed in your D6-site before even thinking about starting an upgrade to D7...

Exactly, what do you mean?

I'm not a coder ... I just know that according to the update module in the D6 site, ALL modules where up-to-date & there was nothing on the site status page, showing an uncompleted database update. My first encounter with guestbook-related db update was AFTER I replaced it with the D7 version & run the update script.

##################

Update:

I checked again & found I have been have the 6.x-1.x.dev & updated it to 6.x-2.x.dev . I deleted the table in the D7 site DB & imported the updated guestbook table. This time, I got this message:

The following updates returned messages
guestbook module
Update #6200

Failed: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'que1_orbit.permission' doesn't exist: SELECT rid, perm FROM {permission} ORDER BY rid; Array ( ) in guestbook_update_6200() (line 50 of /home/que1/public_html/abc/sites/default/modules/guestbook/guestbook.install).

So exactly what should I do next?

Thank you in advance.

eric_a’s picture

EDIT: Fixed cite markup and issue reference. Sorry if you were spammed by these two edits.
I'm very much inclined to think that these errors are not caused by a bug in guestbook. It's probably caused by either a broken upgrade strategy, or a D7 core bug. It is advised to read the latest upgrade instructions from the latest D7 core version (7.10).

So exactly what should I do next?

Basically you need to start all over from a full backup.
The normal thing to do is upgrade from guestbook-6.x-1.1 to guestbook-6.x-2.0 (meaning that updates 6200 and 6201 are out of the way) and only then experiment with 7.x-2.x-dev. Since this development release is a moving target you must be ready to revert to a D6 installation and try again with a new Guestbook release, otherwise I'm afraid you are basically on your own with fixing your database. Note that the guestbook upgrade path is not just about the guestbook db tables. The system table is also involved. If the schema version column is corrupted, then your upgrade system is broken. I will not be able to give support on this topic.
The patch from #1192778: Implement explicit text format for messages and comments just went in. Thus 7.x-2.x has a new database schema and the upgrade from 6.x now involves altering table definitions and migrating the old global output format variable to the messages and comments.

eric_a’s picture

Category: support » bug
Status: Closed (works as designed) » Active

This looks like a bug after all.
The 6200 update runs after the system has migrated the D6 permission table and thus the update fails. This update function should either be removed from 7.x-2.x or completely rewritten for D7.

eric_a’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
dhigby’s picture

Subscribing. Same error after upgrade and I have disabled the Guestbook, hoping for a solution. Might try to export the old entries and start over (since they all show up just fine despite the error).

eric_a’s picture

Title: DB error on updating from D6 to D7 » DB error on updating from Guestbook 6.x-1.x to D7
Component: User interface » Code
Status: Active » Needs review
StatusFileSize
new2.18 KB

My preferred solution would be to not support a direct upgrade from 6.x-1.x to 7.x.

3. In addition to updating to the latest available version of Drupal 6.x core,
you must also upgrade all of your contributed modules for Drupal to their
latest Drupal 6.x versions.

sun’s picture

StatusFileSize
new1.31 KB

I think we can support a upgrade from (latest) 6.x-1.x to 7.x-2.x relatively easily. I've seen harder upgrade path issues in the past ;)

eric_a’s picture

Should an implementation of hook_update_last_removed() be added to the patch in #8?

florisg’s picture

Confirmed #8 works
Functionality is ported and tested d6 -> d7 with this code,
Did not remove guestbook_update_6001
Only adapted the bottom part:

 function guestbook_update_6200() {
-  $result = db_query("SELECT rid, perm FROM {permission} ORDER BY rid");
-  while ($role = db_fetch_object($result)) {
-    $renamed_permission = strtr($role->perm, array('administer all guestbooks' => 'moderate all guestbooks'));
-    if ($renamed_permission != $role->perm) {
-      db_query("UPDATE {permission} SET perm = '$renamed_permission' WHERE rid = " . $role->rid);
-    }
-  }
+  db_update('role_permission')
+    ->fields(array('permission' => 'moderate all guestbooks'))
+    ->condition('permission', 'administer all guestbooks')
+    ->execute();
eric_a’s picture

Status: Needs review » Fixed
StatusFileSize
new1.34 KB
new333 bytes

Thanks all! Pushed #11 to 7.x-2.x.

Status: Fixed » Closed (fixed)

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