首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Drupal 7更新架构中断

Drupal 7更新架构中断
EN

Stack Overflow用户
提问于 2016-09-22 05:34:26
回答 1查看 65关注 0票数 0

谁能告诉我我是不是漏掉了什么?它总是在代码块后面抛出底部提到的错误。

代码语言:javascript
运行
复制
function license_update_7101() {

  $schema['license_agreements'] = array(
    'description' => 'License User Agreements',
    'fields' => array(
      'license_id' => array(
        'description' => 'Primary key for license records',
        'type'        => 'serial',
        'not null'    => TRUE,
        'unsigned'    => TRUE
      ),
      'user_id' => array(
        'description' => 'License agreed to by User ID',
        'type'        => 'int',
        'not null'    => FALSE,
        'unsigned'    => TRUE,
        'default'     => '0'
      ),
      'product_id' => array(
        'description' => 'Product ID that represents the product this agreement was assigned to.',
        'type'        => 'int',
        'not null'    => FALSE,
        'unsigned'    => TRUE,
        'default'     => '0'
      ),
      'session' => array(
        'description' => 'Session created during account creation.',
        'type'        => 'varchar',
        'length'      => 32,
        'not null'    => FALSE,
        'default'     => ''
      ),
      'agreed' => array(
        'description' => 'Represents if the license was agreed to or not',
        'type'        => 'int',
        'size'        => 'tiny',
        'not null'    => FALSE,
        'unsigned'    => TRUE,
        'default'     => '0'
      ),
      'agreement_date' => array(
        'description' => 'Date this license was agreed to by user.',
        'type'        => 'datetime',
        'mysql_type'  => 'DATETIME',
        'disp-width'  => '11',
        'not null'    => FALSE,
        'default'     => NULL
      ),
      'blog_name' => array(
        'description' => 'URL for actual product license belongs to.',
        'type'        => 'varchar',
        'length'      => '128',
        'not null'    => FALSE,
        'default'     => ''
      ),
      'primary key' => array('license_id')
    )
  );

  db_create_table('license_agreements', $schema['license_agreements']);
}

错误:

代码语言:javascript
运行
复制
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB    [error]
server version for the right syntax to use near 'DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'License' at line 9

真的很想解决这个问题。

谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-09-22 21:45:27

因此,感谢另一位开发人员来帮助我找出是什么导致了爆炸,我设法在我们解决它的过程中发现了这个问题。

代码语言:javascript
运行
复制
'primary key' => array('license_id')

我最终注意到它嵌入在字段数组中,需要在它的外部/之后。

因此,修复方法很简单,只需将该行下移为license_agreements数组的一个数组元素。问题解决了!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39626929

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档