[support] Clarification about hook_schema(), hook_update() and hook_install() in D6

Pierre Rineau pierre.rineau at makina-corpus.com
Mon Oct 13 10:27:05 UTC 2008


Hello!

I need some clarification on D6 behavior with hook_install(),
hook_update() and hook_schema().

This is my question within a simple use case:

When I write a module, I implement hook_schema().
I then do a hook_install() which call drupal_install_schema() function.

Then ok, it works.

BUT, then I have to add a single field to my database. So, I write a
hook_update_N() and use drupal_add_field().

Ok, this works.

The question is: do I have to modify my hook_schema so it carries the
new field or not ?
When a new user will install the module, does drupal just assume that
the schema is up to date then it does not need to do the updates ?

Simple question. It was this behavior with D5, but I'm not sure with D6.

Thanks.



More information about the support mailing list