Search code examples
drupalmoduledrupal-7

Drupal how to update module database


I have a module with his .install, in this one I put my update :

function ga_crm_update_7135() {
  $table = 'ga_historique_commande';
  $schema = drupal_get_schema_unprocessed('ga_historique_commande', $table);
  db_add_field($table, 'historique_filemaker', $schema['fields']['historique_filemaker']);
}

But the database doesn't change after reload and flush cache, is there anything to do to relaunch the .install ?


Solution

  • DB updates are triggered via YOURSITE/update.php not by flushing a cache or reloading.

    There you will see listed all pending updates on DB, if you don't see yours check the documentation:

    https://www.drupal.org/docs/7/api/schema-api/updating-tables-hook_update_n-functions