You are here

db_add_field db_change_field, drupal 6, drupal 7下的异同

g089h515r806 的头像
Submitted by g089h515r806 on 星期日, 2011-03-06 11:03

6 db_change_field(&$ret, $table, $field, $field_new, $spec, $keys_new = array())
7 db_change_field($table, $field, $field_new, $spec, $keys_new = array())

 

6 db_add_field(&$ret, $table, $field, $spec, $keys_new = array())
7 db_add_field($table, $field, $spec, $keys_new = array())

我们在升级站点是,flag模块,升级时报错,

 

flag_actions module
Update #6200
  • Failed: DatabaseSchemaObjectDoesNotExistException: Cannot add field <em class="placeholder"></em>.<em class="placeholder">flag_actions</em>: table doesn't exist. in DatabaseSchema_mysql->addField() (line 321 of F:\xampp\htdocs\zuowen\includes\database\mysql\schema.inc).

 

我仔细的检查了这个模块的

•6200 - Add a "repeat_threshold" value to all existing Flag actions.

通过对比数据库,发现这段代码:

db_add_field($ret, 'flag_actions', 'repeat_threshold', $column);

没有起作用,查了一下API,发现Drupal6,drupal7的API变了,我的代码里还是6的,把它改为Drupal7的,重新运行update.php。正常了。

Drupal版本: