Parasolx

Professional in Drupal web development, theme designing, consultation and training

Fail updating database structure Drupal 7.34

15 Dec 2014 - 12:56 am

In version Drupal 7.33 there is an updating database structure to lengthing the block title from 64 characters to maximum length which is 255. This update can be apply without any error if site was built fresh from Drupal 7. However for those experience migrating from Drupal 5 or Drupal 6, its may or may not display an error during this process.

You may encounter this error during updating process:

Update #7009

  • Failed: PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'title' at row 192: ALTER TABLE {block} CHANGE `title` `title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Custom title for the block. (Empty string will use block default title, <none> will remove the title, text will cause block to use specified title.)'; Array ( ) in db_change_field() (line 3020 of /home/parasolx/public_html/includes/database/database.inc).

If you look at error, it comes from the data in the tables that block the scripts to update the table structures. After drill down into database, I found that row 192 contain "NULL" in title field which is should not happen. This is because title is mandatory when creating a new block.

However, previous framework Drupal may bypass this validation which cause the block to create without a title. To counter this problem, I run this script:

UPDATE block SET title = '' WHERE title IS NULL;

You can use this SQL within your database management programme such as phpMyAdmin. After that try running to update the database again. Mine works perfectly after troubleshoot this error.

Kategori: 
Tags: 
update 7009
block null in title
sql script running