安装Prestashop模块时出现MySQL错误

安装Prestashop模块时出现MySQL错误,mysql,module,prestashop,Mysql,Module,Prestashop,我为prestashop制作了模块。只需将基本管理表单写入数据库即可。但当我尝试在Prestashop安装模块时,出现以下错误: [PrestaShopDatabaseException] Duplicate entry '0' for key 'PRIMARY' INSERT INTO `ps_module` (`name`, `active`, `version`) VALUES ('apishippingtextsource', '1', '0.0.1') at line 635

我为prestashop制作了模块。只需将基本管理表单写入数据库即可。但当我尝试在Prestashop安装模块时,出现以下错误:

[PrestaShopDatabaseException]

Duplicate entry '0' for key 'PRIMARY'


INSERT INTO `ps_module` (`name`, `active`, `version`) VALUES ('apishippingtextsource', '1', '0.0.1')

at line 635 in file classes/db/Db.php
629.            WebserviceRequest::getInstance()->setError(500, '[SQL Error] '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);
630.        }
631.        else if (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))
632.        {
633.            if ($sql)
634.                throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');
635.            throw new PrestaShopDatabaseException($this->getMsgError());
636.        }
637.    }
638. 
639.    /**

Prestashop的版本是1.6.0.9

您能检查您的
ps\u模块的
auto\u increment
值吗?可能未定义或未将
自动增量设置为0


如果是这种情况,您可能在数据库迁移过程中出错,或者安装了另一个模块,该模块与
auto_increment

相冲突。您可以检查
ps_模块的
auto_increment
表结构的
值吗?也许
自动增量
没有定义或定义为
0
@florianlemaritre非常感谢,我是个白痴。我没有为id列设置自动增量。这是一个问题,如何可能,安装了模块:D
$sql = array();

$sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'api_shipping_text` (
        `id_text` int(10) unsigned NOT NULL AUTO_INCREMENT,
        PRIMARY KEY  (`id_text`)
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;';

foreach ($sql as $query) {
    if (Db::getInstance()->execute($query) == false) {
        return false;
    }
}