My Drupal installation has a table with a field title
of type varchar and length of 255.
For some custom process, I need to increase the length to 500 characters.
I tried doing so with the following code:
function mymodule_schema_alter(&$schema){
if( isset($schema['field_data_field_document_title']) ){
db_change_field('field_data_field_document_title', 'field_document_title_value', 'field_document_title_value',
array(
'length' => 11,
)
);
}
}
Originally I had that code in my .module file. When I flushed caches I could verify using the DEVEL module that my field length changed. But in phpmyadmin the field length remained 255.
Then I migrated the function to the .install file. I execute run updates and get the following error:
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 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 'DEFAULT NULL' at line 1: ALTER TABLE {field_data_field_document_title} CHANGE
field_document_title_value
field_document_title_value
DEFAULT NULL; Array ( ) in db_change_field() (line 3020 of /var/www/Intranet/includes/database/database.inc).
I could really use some help, please.