在drupal 8中未创建数据库架构

问题描述 投票:0回答:1

我正在使用.install文件中的代码创建数据库模式,但未创建任何模式。我的模块在定义了自定义表单的地方有效,但是当我创建此代码并运行此代码时,它返回空值,所以这是怎么回事。这是我的代码:

function drupalup_simple_form_schema()
{
  $schema['drupal_table'] = array
  (
      'fields' =>array
      (

          'id'=>array
          (
            'type'=>'serial',
            'length'=>11,
            'unsigned' =>TRUE,
            'not null'=>TRUE,
          ),

          'uid'=>array
          (
            'type'=>'int',
            'length'=>11,
            'not null'=>TRUE,
            'default'=>0,
          ),

          'first_name'=>array
          (
            'type'=>'varchar',
            'length'=>255,
            'not null'=>FALSE,
            'default'=>'',
          ),

      ),
       'primary key' => array('id'), 
  );

  return $schema;
}
?>```
php drupal-8
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.