Got this after upgrading to D7 (from D5)

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'w.block' in 'where clause': SELECT w.*, n.title AS title FROM {webform} w LEFT OUTER JOIN {node} n ON w.nid = n.nid WHERE (w.block = :db_condition_placeholder_0) AND (n.type IN (:db_condition_placeholder_1)) ; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => webform ) in webform_block_info() (line 1404 of /home/dm7/sites/all/modules/contrib/webform/webform.module

Comments

quicksketch’s picture

Did you upgrade to the Drupal 6 version first? You can't upgrade directly from Drupal 5 to Drupal 7.

mgifford’s picture

Yup. Certainly core and I'm pretty sure this module.

Was actually 6.19 version of core, but that should be fine.

quicksketch’s picture

Hm, I have no idea how to solve this problem. If you can upgrade to Drupal 6 and find the problem there this would be solvable. There are very few database differences between the D6 and D7 version, so my guess is this problem would have occurred between D5 and D6.

Looking at the code, the update that adds this column is webform_update_6321(). It's a pretty simple update, I don't see how anything would have gone wrong with it had it been run.

quicksketch’s picture

Status: Active » Postponed (maintainer needs more info)
mgifford’s picture

I'll let you know if I run into this problem with a simpler D6 to D7 upgrade. Thanks again for the quick response!

gstegemann’s picture

Version: 7.x-3.4-beta1 » 7.x-3.6

Have the same problem. Site was migrated from Drupal 6.20 to 7. Even update.php stops working.

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'w.block' in 'where clause': SELECT w.*, n.title AS title FROM {webform} w LEFT OUTER JOIN {node} n ON w.nid = n.nid WHERE (w.block = :db_condition_placeholder_0) AND (n.type IN (:db_condition_placeholder_1)) ; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => webform ) in webform_block_info() (Zeile 1423 von /var/www/html/cm7/sites/all/modules/webform/webform.module).

You have to disable the module to update.php working again.

gstegemann’s picture

I think I have found the cause of the problem. It occurs when you migrate to D7 keeping webform at version 2.x.

Looking at the code I found the following info:

 * Currently you cannot upgrade from 2.x in Drupal 6 to 3.x in Drupal 7. However
 * there are no database changes between the 3.x versions, so no update is
 * needed at all to move from 3.x in Drupal 6 to Drupal 7.

To fix the problem I have upgraded webform to 3.6 on my D6 site which in turn performed all the missing database updates. Then I copied the updated webform database tables to the D7 database and updated the schema version accordingly. After re-enabling the webform module on the D7 site the 7.x updates were applied and everything seems be operational now.

quicksketch’s picture

Category: bug » support
Status: Postponed (maintainer needs more info) » Fixed
vikingew’s picture

Status: Fixed » Needs work

This issue is in no way fixed, just swept under the carpet! You need to either create an upgrade path from 6.x-2.x to 7.x.3.x OR be more explicite in your instructions about upgrade not only from 2.x to 3.x but also from D6 to D7

(Almost) needless to say I ran into this issue as well and before upgrading, in good order I visit the webform project page to look for instruction and there is no indication that an upgrade from 2.x to 3.x in D6 is mandatory before an upgrade to D7 is possible.

It would have saved me, and possibly others, extra work as I just been waiting for upgrading to D7 I didn't bother about the 2.x to 3.x upgrade in D6, because there were no indication I needed to and it's in the human nature that not do more then you have to. I just want to point this ;-)

Apart from that, thanks for a great module!

quicksketch’s picture

Status: Needs work » Fixed

I updated the README.txt in the latest version to include this note:

Note that if you are upgrading from a Drupal 6 installation of Webform, you MUST
have been running Webform 3.x on your Drupal 6 site before upgrading to Drupal
7 and Webform 3.x. You cannot upgrade directly from Webform 6.x-2.x to Webform
7.x-3.x.

I don't think putting it on the already crowded project page is necessary as many modules will not update to Drupal 7 unless they're running the latest version from D6. Like I said, I don't plan on rewriting updates to support direct 6.x-2.x to 7.x-3.x updates, this is as "fixed" as it will get.

Status: Fixed » Closed (fixed)
Issue tags: -7x upgrade

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

skatheeth’s picture

Hey GStegemann,

I did the same, as you have posted in #7, I want to know what are the schema changes you did in Drupal 7 webform module, so that I can implement it on my application.

Regards,
Shraddha

gstegemann’s picture

Hi skatheeth,

in fact, I didn't made any direct schema changes to the Webform database tables. After copying the 3.x Webform database tables into the D7 site database I adjusted the "schema version number" in the sites System table.

Here an example:

mysql> use drupal6;
Database changed

mysql> desc system;
+----------------+--------------+------+-----+---------+-------+
| Field          | Type         | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+-------+
| filename       | varchar(255) | NO   | PRI |         |       |
| name           | varchar(255) | NO   |     |         |       |
| type           | varchar(255) | NO   | MUL |         |       |
| owner          | varchar(255) | NO   |     |         |       |
| status         | int(11)      | NO   |     | 0       |       |
| throttle       | tinyint(4)   | NO   |     | 0       |       |
| bootstrap      | int(11)      | NO   |     | 0       |       |
| schema_version | smallint(6)  | NO   |     | -1      |       |
| weight         | int(11)      | NO   |     | 0       |       |
| info           | text         | YES  |     | NULL    |       |
+----------------+--------------+------+-----+---------+-------+
10 rows in set (0.00 sec)

mysql> select schema_version from system where name='webform';
+----------------+
| schema_version |
+----------------+
|           6331 |
+----------------+
1 row in set (0.06 sec)

In this example the schema version of the Webform 3.x module at the D6 site is 6331, after all updates were applied. This number has to be applied to the D7 site using an appropriate database tool.

Gerhard