Hello,

I'm trying to upgrade a copy of my site on my localhost. I am having difficulty figuring out how to upgrade node_gallery. I currently have 2.0-beta2 installed and I'm trying to upgrade to version 3.2. After updating the node_gallery code to version 3.2 and then running drush updb I received the following messages.

Executing node_gallery_update_6300                                                                        [success]
Column count doesn't match value count at row 1                                                      [warning]
query: INSERT INTO node_gallery_galleries (SELECT DISTINCT gid, NULL FROM node_galleries)
database.mysql.inc:135
DELETE FROM {node_gallery_galleries}                                                                      [success]
DELETE FROM {node_gallery_images}                                                                         [success]
INSERT INTO {node_gallery_galleries} (SELECT DISTINCT gid, NULL FROM {node_galleries})                    [error]
UPDATE {node_gallery_galleries} new JOIN {node_galleries} old ON new.gid = old.gid SET cover_image = nid  [success]
WHERE is_cover > 0
INSERT INTO {node_gallery_images} (SELECT nid,gid,weight FROM {node_galleries})                           [success]
DROP TABLE {node_galleries}                                                                               [success]
Executing node_gallery_update_6301                                                                        [success]
Executing node_gallery_update_6302                                                                        [success]
Executing node_gallery_update_6303                                                                        [success]
Executing node_gallery_update_6304                                                                        [success]
Added 6 empty galleries into node_gallery_galleries table.                                                [success]
Executing node_gallery_update_6305                                                                        [success]
Duplicate column name 'img_count'                                                               [warning]
query: ALTER TABLE node_gallery_galleries ADD `img_count` SMALLINT unsigned NOT NULL DEFAULT 0
database.mysql.inc:135
Duplicate column name 'pub_img_count'                                                           [warning]
query: ALTER TABLE node_gallery_galleries ADD `pub_img_count` SMALLINT unsigned NOT NULL DEFAULT 0
database.mysql.inc:135
Duplicate key name 'img_count'                                                                  [warning]
query: ALTER TABLE node_gallery_galleries ADD INDEX img_count (img_count) database.mysql.inc:135
Duplicate key name 'pub_img_count'                                                              [warning]
query: ALTER TABLE node_gallery_galleries ADD INDEX pub_img_count (pub_img_count) database.mysql.inc:135
ALTER TABLE {node_gallery_galleries} ADD `img_count` SMALLINT unsigned NOT NULL DEFAULT 0                 [error]
ALTER TABLE {node_gallery_galleries} ADD `pub_img_count` SMALLINT unsigned NOT NULL DEFAULT 0             [error]
ALTER TABLE {node_gallery_galleries} ADD INDEX img_count (img_count)                                      [error]
ALTER TABLE {node_gallery_galleries} ADD INDEX pub_img_count (pub_img_count)                              [error]
Created initial image count values for 2 galleries.                                                       [success]
The content type Gallery has been added.                                                                  [status]
An error has occurred adding the content type node_gallery_gallery.Please check the errors displayed for  [status]
more details.
Node type node_gallery_gallery created/modified.                                                          [status]
The content type Gallery Image has been added.                                                            [status]
An error has occurred adding the content type node_gallery_image.Please check the errors displayed for    [status]
more details.
Node type node_gallery_image created/modified.                                                            [status]
Upgraded 29 total images to imagefield.                                                                   [status]
Imagefield doesn't provide per-role file limits without extra modules.  If you wish to maintain those,    [status]
please use the Node Limit Number module.
ImageCache preset 13: node-gallery-admin-thumbnail and corresponding actions saved.                       [status]
Node Gallery upgrade complete.  Please review UPGRADING.txt.                                              [status]
No orphaned rows were found in the database.                                                              [status]
You have selected to display 20 images per page.  The default is 0 (unlimited) - you may change the value [warning]
by editing the view.
Finished performing updates.                                                                              [ok]

Is this normal output for the upgrade I am trying to do?

After the upgrade, my one gallery is no longer displaying as it did. The photo covers are not displaying and galleries that were empty now show, when they didn't use to show.

Do I have to rebuild all of the galleries from scratch? Perhaps I should start over since my galleries are relatively small. Suggestions are welcome!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tylerz’s picture

Exact same errors for me with the same versions, on a local OSX installation and on the hostgator server. Unfortunately I have tons of images and galleries to convert over, so recreating the content would be drastically inconvenient to my client.

Any ideas, thoughts? I can provide database table content info if there is anything suspected.

tylerz’s picture

My attempt at the update was not with Drush, and above the errors that Dave saw, I also had the following which may be helpful, however I take it that they are just the errors in the PHP as a consequence of the already stated mySQL errors:

Drupal database update
The content type Gallery has been added.
Node type node_gallery_gallery created/modified.
The content type Gallery Image has been added.
The field Gallery Image (field_node_gallery_image) was added to the content type Gallery Image.
Node type node_gallery_image created/modified.
Upgraded 1208 total images to imagefield.
Imagefield doesn't provide per-role file limits without extra modules. If you wish to maintain those, please use the Node Limit Number module.
Imagefield doesn't provide tokenized paths without extra modules. If you wish to maintain those, please use the FileField Paths module.
Imagefield doesn't provide per-role file limits without extra modules. If you wish to maintain those, please use the Node Limit Number module.
Imagefield doesn't provide tokenized paths without extra modules. If you wish to maintain those, please use the FileField Paths module.
ImageCache preset 4: node-gallery-admin-thumbnail and corresponding actions saved.
Node Gallery upgrade complete. Please review UPGRADING.txt.
No orphaned rows were found in the database.
user warning: Column count doesn't match value count at row 1 query: INSERT INTO iwldrup_node_gallery_galleries (SELECT DISTINCT gid, NULL FROM iwldrup_node_galleries) in /Users/tyler/Sites/drupal/sites/all/modules/node_gallery/node_gallery.install on line 796.
warning: array_fill(): Number of elements must be positive in /Users/tyler/Sites/drupal/includes/database.inc on line 253.
warning: implode(): Invalid arguments passed in /Users/tyler/Sites/drupal/includes/database.inc on line 253.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND ng.gid IS NULL' at line 1 query: SELECT nid as gid FROM iwldrup_node n LEFT JOIN iwldrup_node_gallery_galleries ng on ng.gid = n.nid WHERE n.type IN () AND ng.gid IS NULL in /Users/tyler/Sites/drupal/sites/all/modules/node_gallery/node_gallery.install on line 900.
user warning: Duplicate column name 'img_count' query: ALTER TABLE iwldrup_node_gallery_galleries ADD `img_count` SMALLINT unsigned NOT NULL DEFAULT 0 in /Users/tyler/Sites/drupal/includes/database.mysql-common.inc on line 307.
user warning: Duplicate column name 'pub_img_count' query: ALTER TABLE iwldrup_node_gallery_galleries ADD `pub_img_count` SMALLINT unsigned NOT NULL DEFAULT 0 in /Users/tyler/Sites/drupal/includes/database.mysql-common.inc on line 307.
user warning: Duplicate key name 'img_count' query: ALTER TABLE iwldrup_node_gallery_galleries ADD INDEX img_count (img_count) in /Users/tyler/Sites/drupal/includes/database.mysql-common.inc on line 443.
user warning: Duplicate key name 'pub_img_count' query: ALTER TABLE iwldrup_node_gallery_galleries ADD INDEX pub_img_count (pub_img_count) in /Users/tyler/Sites/drupal/includes/database.mysql-common.inc on line 443.

tylerz’s picture

Category: support » bug
Priority: Normal » Major
tylerz’s picture

Got past the point by changing line 796 to:

$ret[] = update_sql('INSERT INTO {node_gallery_galleries} (SELECT DISTINCT gid, NULL, 0, 0 FROM {node_galleries})');

Basically it seems there was an update version that was the initial schema change, but had less columns than in the current one. Then the new columns were added and the .install uses the module schema to create the tables as such, but the update tries to do a select from the smaller table it is updating from, and then later calls the alter statements.

tylerz’s picture

After that, there were still errors and the imagefields were not filled in. In the end I did the update as much as it could take me and then did manual SQL queries to copy the contents of the old table entries to the new tables. If anybody needs help to simply get their gallery converted, I can provide the queries I used.

Tabestan’s picture

Tyler, I'm interested in the queries you used as I'm facing the same issues.
Thanks.

southweb’s picture

Is there any progress on this. I need to update numerous client sites and require drush to work properly as there isn't the budget to go digging into the code. Can we PLEASE have a new release that performs an upgrade from 2 with drush successfully and cleanly!!!

zengenuity’s picture

Status: Active » Closed (won't fix)

The D6 maintainers have all left this project, and I'm not able to support issue with 2.x to 3.x upgrade. I just don't know enough about the changes to do it. Sorry.

southweb’s picture

Thanks for your reply. I'm half tempted to get one of my contractors to do this job and give you the results.

But just in terms of effort, surely all that needs doing is write a script that will:

1. Capture/store the data from the existing v2x install (i.e. understand the original schema)
2. Deinstall and completely remove all references to it.
3. Fresh install v3.
4. Apply a schema conversion to the original data to make it compatible with v3.

Am I missing something here?

Dane Powell’s picture

Status: Closed (won't fix) » Needs review
FileSize
7.27 KB

Here is a fix. It follows the method of Views and Mailhandler- i.e., it stores the schema definition is separate update functions, rather than in the monolithic hook_schema, which might change with every version.

Dane Powell’s picture

Fixed a careless typo in #10 (missing return statement).