首页 > 解决方案 > Drupal如何更新模块数据库

问题描述

我有一个带有他的 .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 ?

标签: drupalmoduledrupal-7

解决方案


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

在那里,您将看到 DB 上列出的所有待处理更新,如果您没有看到您的更新,请查看文档:

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


推荐阅读