Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Following a recent update from 7.x-1.3 to 7.x-2.3, existing block classes were wiped out. Attempting to set a block class again through the block configuration now results in an error:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'css_class' in 'field list': UPDATE {block} SET css_class=:db_update_placeholder_0 WHERE (module = :db_condition_placeholder_0) AND (delta = :db_condition_placeholder_1) ; Array ( [:db_update_placeholder_0] => icons [:db_condition_placeholder_0] => block [:db_condition_placeholder_1] => 7 ) in block_class_form_submit()
Looks like for some reason the block_class column was not created when the DB update 7103 ran, and existing block classes were not migrated.
Comments
Comment #2
John Pitcairn CreditAttribution: John Pitcairn commentedWorkaround: disabling then re-enabling the module will create the DB column, but you will still need to re-create all the missing block classes manually.
Comment #3
DYdave CreditAttribution: DYdave at DAVYIN Internet Solutions / 戴文信息科技有限公司 commentedHi @John Pitcairn,
Thank you very much for your interest in the Block Class module and for reporting this issue.
Any idea why the
block_class
column wouldn't have been created in DB?Did you get any PHP error messages in the logs?
Did you get any Database error messages in the DB logs?
As you can see the code for the update function
block_class_update_7103
is pretty simple and straight forward, see block_class.install, line 129.I'm wondering if some error, perhaps related with the length of stored data (32, 64, 255, ...) or the data type (VARCHAR, ....) or even maybe its encoding could have been the cause of this error....
If anybody else gets this error again, it would be great if we could please provide much more information related with the problem.
A dump of the block_class table DB structure would be great.
Taking a closer look at the data would also be helpful.
More feedback and testing on this issue would be greatly appreciated.
Thanks very much in advance.
Comment #4
John Pitcairn CreditAttribution: John Pitcairn commentedThe update from 1.x to 2.x was run via
drush up
anddrush updatedb
, and did not report any errors in the console.Comment #5
bapi_22 CreditAttribution: bapi_22 as a volunteer and at Cybage Software Pvt Ltd. commentedHi John,
Tested and seems Its working properly either update using admin interface or in Drush command line interface.
Comment #6
DYdave CreditAttribution: DYdave at DAVYIN Internet Solutions / 戴文信息科技有限公司 commentedThanks @bapi_22,
very much for following up on this and reporting back the results of your tests on this.
I would also be rather surprised if there was any problem with this update code, that's why I suggested, in #3, that the problem might have come from a conflicting or different source.
Unfortunately, due to a lack of information, all we can really say is that under "normal" conditions, it should work fine.
Keeping this open a little bit longer to see if anybody else would care stepping in.
Many thanks again to everyone for your great help, reviews, testing, reporting and participation in this module's issue tracker.
Comment #7
DYdave CreditAttribution: DYdave at DAVYIN Internet Solutions / 戴文信息科技有限公司 commentedNo feedback on this issue for a month.
I would assume an appropriate solution should have already been found by ticket's author.
Additionally, no one else reported any issue that could be similar.
Therefore, I allowed myself to mark this issue as Fixed for now, but feel free to re-open it, or post a new ticket, at any time if you have any further objections with the questions raised in this ticket (we would surely be happy to hear your feedback).
Please let us know if you would have any further comments, feedback, questions, issues, objections, suggestions or concerns on the suggested solution, this comment or this ticket in general, we would be glad to provide more information or explain in more details.
Many thanks to everyone for your great help, reviews, testing, reporting and participation in this module's issue tracker.
Cheers!
Comment #9
Miriammm CreditAttribution: Miriammm commentedI had the same problems, updating from 7.x-1.3 to 7.x-2.3, and eventually managed to resolve it by updating to 7.x-2.2 first, run update.php (which creates the column), refresh caches and then apply the 7.x-2.3-update.
Hope this helps!