Question

I am working on a pre-created Drupal 8 project that has a custom module called CCA(named out of project title). I have done the below update in the .install file to add a new column to the backend via Drupal.

function cca_update_8902 (&$sandbox) {
  db_add_field('cca_findings', 'cca_topic_id', array(
    'type' => 'float',
    'not null' => FALSE,
    'description' => 'interim fields addition',
  ));

How do I update the module in Drupal after this change has been made? Can someone guide on next steps to update my custom module in Drupal so that this change will be implemented? Thanks!

Was it helpful?

Solution

Visit /update.php on your site when logged in as admin, or use drush updatedb

Note that in addition to changing the table in the hook_update_N(), you must also change the schema of the cca_findings table in hook_schema() so that new installs of your module will have the proper table structure. Update functions are not used on new installs of your module.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top