CakePHP 3 - Debugkit给出了数据库错误

时间:2015-11-03 08:24:36

标签: cakephp-3.0

有时候,我的应用程序会给我一个错误:

2015-11-03 07:54:42 Error: [PDOException] SQLSTATE[23000]: Integrity constraint violation: 19 column id is not unique

请求网址:/ 堆栈跟踪:

#0 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/Database/Statement/StatementDecorator.php(169): PDOStatement->execute(NULL)
#1 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/Database/Statement/StatementDecorator.php(169): Cake\Database\Statement\StatementDecorator->execute(NULL)
#2 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/Database/Statement/BufferedStatement.php(74): Cake\Database\Statement\StatementDecorator->execute(NULL)
#3 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/Database/Statement/SqliteStatement.php(41): Cake\Database\Statement\BufferedStatement->execute(NULL)
#4 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/Database/Connection.php(274): Cake\Database\Statement\SqliteStatement->execute()
#5 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/Database/Query.php(176): Cake\Database\Connection->run(Object(Cake\ORM\Query))
#6 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/ORM/Table.php(1520): Cake\Database\Query->execute()
#7 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/ORM/Table.php(1436): Cake\ORM\Table->_insert(Object(DebugKit\Model\Entity\Panel), Array)
#8 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/ORM/Table.php(1367): Cake\ORM\Table->_processSave(Object(DebugKit\Model\Entity\Panel), Object(ArrayObject))
#9 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/Database/Connection.php(561): Cake\ORM\Table->Cake\ORM\{closure}(Object(Cake\Database\Connection))
#10 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/ORM/Table.php(1368): Cake\Database\Connection->transactional(Object(Closure))
#11 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/ORM/Association/HasMany.php(121): Cake\ORM\Table->save(Object(DebugKit\Model\Entity\Panel), Array)
#12 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/ORM/AssociationCollection.php(254): Cake\ORM\Association\HasMany->saveAssociated(Object(Cake\ORM\Entity), Array)
#13 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/ORM/AssociationCollection.php(230): Cake\ORM\AssociationCollection->_save(Object(Cake\ORM\Association\HasMany), Object(Cake\ORM\Entity), Array, Array)
#14 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/ORM/AssociationCollection.php(195): Cake\ORM\AssociationCollection->_saveAssociations(Object(DebugKit\Model\Table\RequestsTable), Object(Cake\ORM\Entity), Array, Array, true)
#15 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/ORM/Table.php(1447): Cake\ORM\AssociationCollection->saveChildren(Object(DebugKit\Model\Table\RequestsTable), Object(Cake\ORM\Entity), Array, Array)
#16 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/ORM/Table.php(1367): Cake\ORM\Table->_processSave(Object(Cake\ORM\Entity), Object(ArrayObject))
#17 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/Database/Connection.php(561): Cake\ORM\Table->Cake\ORM\{closure}(Object(Cake\Database\Connection))
#18 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/ORM/Table.php(1368): Cake\Database\Connection->transactional(Object(Closure))
#19 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/debug_kit/src/Routing/Filter/DebugBarFilter.php(209): Cake\ORM\Table->save(Object(Cake\ORM\Entity))
#20 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/Event/EventManager.php(389): DebugKit\Routing\Filter\DebugBarFilter->afterDispatch(Object(Cake\Event\Event), Object(Cake\Network\Request), Object(Cake\Network\Response))
#21 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/Event/EventManager.php(355): Cake\Event\EventManager->_callListener(Array, Object(Cake\Event\Event))
#22 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/Event/EventDispatcherTrait.php(78): Cake\Event\EventManager->dispatch(Object(Cake\Event\Event))
#23 /var/zpanel/hostdata/zadmin/public_html/vendor/cakephp/cakephp/src/Routing/Dispatcher.php(92): Cake\Routing\Dispatcher->dispatchEvent('Dispatcher.afte...', Array)
#24 /var/zpanel/hostdata/zadmin/public_html/webroot/index.php(37): Cake\Routing\Dispatcher->dispatch(Object(Cake\Network\Request), Object(Cake\Network\Response))
#25 {main}

有时会出现此错误,并非总是如此。 我认为是DebugKit和SQLite数据库错误。 现在我已经在应用程序中禁用了调试模式来测试它。

1 个答案:

答案 0 :(得分:0)

您可能拥有旧版本的数据库。我建议您删除当前的数据库文件,然后重试:

rm tmp/debug_kit.sql