Drupal如何更新模块数据库

Drupal how to update module database

我有一个包含他的 .install 的模块,我在这个模块中放置了我的更新:

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']);
}

但是数据库在重新加载和刷新缓存后没有改变,有什么办法可以重新启动 .install 吗?

数据库更新是通过 YOURSITE/update 触发的。php 而不是刷新缓存或重新加载。

在那里您会看到列出了数据库中所有待处理的更新,如果您没有看到自己的更新,请查看文档:

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