Warning: Undefined array key "HTTPS" in include() (line 29 of /opt/www/fdv2/drupal.stage/web/sites/default/settings.local.php).
include('/opt/www/fdv2/drupal.stage/web/sites/default/settings.local.php') (Line: 4)
require('/opt/www/fdv2/drupal.stage/web/sites/drupal001.net/settings.php') (Line: 145)
Drupal\Core\Site\Settings::initialize('/opt/www/fdv2/drupal.stage/web', 'sites/drupal001.net', Object) (Line: 1099)
Drupal\Core\DrupalKernel->initializeSettings(Object) (Line: 701)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
如何在node表中添加一个字段? - Drupal大学 - Drupal问答论坛
首页 / 帖子
如何在node表中添加一个字段?

我的模块xcc, 我在xcc.install文件中想给node表,添加一个字段叫 website,我定义了下面这个方法,把xcc 卸载,再重新安装,结果这个字段没有成功添加,请教窍门,谢谢。

下面是xcc.install文件的中的方法:

function zfm_update_7100(){
    $spec = array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'website from',
    );
    db_add_field( 'node', 'website', $spec);
}

我的DRUPAL的版本是7.31

1个答案
赵高欣
发布于:2014-09-29 19:16

补充:

更名方法名:

function xcc_update_7100(){
    $spec = array(
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'website from',
    );
    db_add_field( 'node', 'website', $spec);
}