0

I'm working with the addressfield module. I need to change the thoroughfare column to have a max length of 960 (or make it a text instead of varchar) instead of the default 255.

However I'm not sure how I should do it.

I've created an empty module with a hook_schema_alter()

function hook_schema_alter(&$schema) {
  $schema['addressfield']['thoroughfare'] = array(
    'description' => 'The thoroughfare of this address. (i.e. Street address)',
    'type' => 'text',
    'default' => '',
    'not null' => FALSE,
  );
  return $schema;
}

However I suspect that the part "$schema['addressfield']['thoroughfare']" is not correct. Nothing is changed when I install the module with this hook.

How to change it? In the original addressfield it returns only columns in the schema hook, it's not really linked to a schema itself?

1 Answer 1

0

That approach won't affect the column type or size as I get you need to make it store more chars.

You could do hook_update_N() that execute a sql query to change the field type and size.

Then yo have to change field settings see

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.