function tripal_example_update_7200
2.x tripal_example.install | tripal_example_update_7200() |
This is the required update for tripal_example.
File
- tripal_example/
tripal_example.install, line 568 - Installation of the example module
Code
function tripal_example_update_7200() {
// EXPLANATION: as you create new releases of your module you may find that
// tables your module created, or data may need to be adjusted. This function
// allows you to do that. This function is executed using the
// http://[your site]/update.php URL or using the drush command 'updatedb'.
// This function should be named according to the instructions provided here:
// https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_update_N/7
//
// Make sure we have the full API loaded this will help during a
// site upgrade when the tripal_core module is disabled.
module_load_include('module', 'tripal_core', 'tripal_core');
tripal_core_import_api();
// it is good to wrap any database changes inside of a try catch block:
try {
// perform database changes
}
catch (\PDOException $e) {
$error = $e->getMessage();
throw new DrupalUpdateException('Could not apply updates: ' . $error);
}
}