I have my own module which implements its own schema. I now want to add a column to the table provided by the schema, which I plan on accomplishing via hook_update_N() and db_add_field().

My question is essentially what the title of this question is: after I add the new column to the schema, should the new column also be placed inside the module's hook_schema() implementation? Example (adds a column named mynewcolumn to the schema of the module mymodule):

function mymodule_update_6000() {
  $ret = array();

  db_add_field($ret, 'mymodule', 'mynewcolumn', array(
    'description' => t('This is my new column'), 
    'type' => 'text',
    'size' => 'big',
    'not null' => FALSE

  return $ret;

At this point, do I place mynewcolumn inside mymodule_schema()? Or does mymodule_update_6000() fully take care of proper installation and uninstallation?

1 Answer 1


hook_update_N() is only used when updating a module, while hook_schema() and hook_install() are used only when installing a module. Since there are users who install the module, the database field must be also added in hook_schema().


Your Answer

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

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