March 2019
Intermediate to advanced
580 pages
15h 3m
English
At the beginning of this chapter, we defined two tables using hook_schema() which got installed together with the module. To reiterate, if the module had already been installed, we could have triggered the schema installation using the drupal_install_schema() function. However, what if we needed to add another column later on, say to the teams table? Our module is installed, and so is the schema; so we cannot exactly uninstall it on production just to trigger the schema creation again, not to mention losing the data. Luckily, there is a system in place for this, namely update hooks— hook_update_N()—where N represents the schema version. These are sequentially named hook implementations that go inside the module *.install file ...