在drupal7中创建一个表时,如何让主键自动增长

  function emailupdate_schema(){
        $schema['emailupdate'] = array(
            'description' => 'The base table for emailupdate.',
            'fields' => array(
                'eid' => array(
                    'description' => 'The primary identifier for email update',
                    'type' => 'int',                     经过测试好像这样不可以是主键自动增长,你需要将type改为 serial
                    'not null' => TRUE,
                    'unsigned' => TRUE,
                ),
                'email' => array(
                    'description' => 'The email of emailupdate.',
                    'type' => 'varchar',
                    'length' => 255,
                    'not null' => TRUE,                   
                ),               
                'confirm_email' => array(
                    'description' => 'The confirm email of email update',
                    'type' => 'varchar',
                    'length' => 255,
                    'not null' => TRUE,
                ),               
                'update_time' => array(
                    'description' => 'The email update content you want to receive',
                    'type' => 'varchar',
                    'length' => 255,
                    'not null' => TRUE,
                ),
               
                'topic_type' => array(
                    'description' => 'The content of toppic you want to receive email',
                    'type' => 'varchar',
                    'length' => 255,
                    'not null' => TRUE
                ),
            ),
            'primary key' => array('eid'),
        );
        return $schema;
    }

你可能感兴趣的:(schema,function,测试,table,null,email)