php - Drupal 7 在使用 postgres 为模块创建模式时获取 PDOException
问题描述
我已经创建了下面的模式来.install
为我在 drupal7 中的一个模块创建一个文件表
$schema['mymodule_categories'] = [
'description' => 'Module Category',
'fields' => [
'id' => [
'description' => 'The primary identifer for a category',
'type' => 'serial',
'unsigned' => true,
'size' => 'small',
'not null' => true,
],
'title' => [
'description' => 'The Title or the name of the category',
'type' => 'varchar',
'length' => 255,
],
'primary key' => ['id'],
],
];
但是当我启用我的模块时,我收到以下错误。
*Notice: Undefined index: type in DatabaseSchema_pgsql->processField() (line 229 of /my/location/projects/project/includes/database/pgsql/schema.inc).
*Notice: Undefined index: :normal in DatabaseSchema_pgsql->processField() (line 229 of /my/location/projects/project/includes/database/pgsql/schema.inc).
*PDOException: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near ")" LINE 5: ) ^: CREATE TABLE {mymodule_categories} ( id serial CHECK (id >= 0), title varchar(255), primary key ); Array ( ) in db_create_table() (line 2827 of /my/location/projects/project/includes/database/database.inc)
我对 drupal cms 本身很陌生,最重要的是,我的项目基于 Postgres。那么有没有办法解决这个问题呢?
解决方案
推荐阅读
- ethereum - web3.eth.sendTransaction 传递参数以及强制事务对象
- php - 为什么 Laravel 5.5 的 Session 数据在登出后会丢失?
- php - PHP脚本内的链接不起作用
- php - 一次选择多个选项
- libgit2sharp - 使用自定义传输获取/克隆/拉取异常
- python - 用于组替换的python正则表达式
- postgresql - Spring Boot Docker Container 无法连接到托管在 Docker 主机上的 postgresql
- c# - 强制用户在使用 WIA 时手动输入凭据
- r - 如何检查某些列是否存在,如果不存在,如何创建它们并用零填充它们?
- osgi - 刷新 OSGI 应用程序上下文