查看插件的 Install.php
文件,其创建 blog_article
表的语句如下
CREATE TABLE IF NOT EXISTS `blog_article` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`created_at` int(11) DEFAULT NULL COMMENT '创建时间',
`created_user_id` int(11) DEFAULT NULL COMMENT '创建admin user id',
`updated_at` int(11) DEFAULT NULL COMMENT '更新时间',
`name` text COMMENT '分类名称',
`status` int(5) DEFAULT NULL COMMENT '产品状态,1代表激活,2代表关闭',
`url_key` varchar(255) DEFAULT NULL COMMENT 'blog article url',
`title` text NOT NULL COMMENT 'blog 标题',
`meta_keywords` text,
`meta_description` text,
`description` text,
`origin_mongo_id` varchar(80) DEFAULT NULL COMMENT 'mongodb表的产品id',
PRIMARY KEY (`id`),
KEY `category_id` (`category_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
上面语句中没有创建 category_id
字段, 却给 category_id
字段创建索引,从而导致 blog_article
表无法正确被创建。