[英]Warning: Fixture creation for “catalog_items” failed " SQLSTATE[42S01]
This is error, which I have got. 这是我得到的错误。 Let me know what is root cause of it.
让我知道其根本原因是什么。
SQLSTATE[42000]: Syntax error or access violation: 1701 Cannot truncate a table referenced in a foreign key constraint (
Proficiency
.t_catalog_item_recommendations
, CONSTRAINTfk_t_catalog_item_recommendations_catalog_item_id
FOREIGN KEY (catalog_item_id
) REFERENCESProficiency
.t_catalog_items
(id
))SQLSTATE [42000]:语法错误或访问冲突:1701无法截断外键约束引用的表(
Proficiency
。t_catalog_item_recommendations
,约束fk_t_catalog_item_recommendations_catalog_item_id
外键(catalog_item_id
)参考Proficiency
。t_catalog_items
(id
))
Whenever i execute my testscripts it gives this message: 每当我执行我的测试脚本时,它都会显示以下消息:
Warning: Fixture creation for "catalog_items" failed "SQLSTATE[42S01]: Base table or view already exists: 1050 Table 't_catalog_items' already exists" in /var/www/html/lib/Cake/TestSuite/Fixture/CakeTestFixture.php on line 244 Call Stack: 0.0018 262208 1. {main}() /var/www/html/app/webroot/test.php:0 0.1119 1133560 2. CakeTestSuiteDispatcher::run() /var/www/html/app/webroot/test.php:97 0.1120 1133968 3. CakeTestSuiteDispatcher->dispatch() /var/www/html/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php:113 0.1205 1278304 4. CakeTestSuiteDispatcher->_runTestCase() /var/www/html/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php:96 0.1314 1320376 5. CakeTestSuiteCommand->run() /var/www/html/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php:253 0.1930 2144664 6. CakeTestRunner->doRun() /var/www/html/lib/Cake/TestSuite/CakeTestSuiteCommand.php:96 0.2285 2481368 7. PHPUnit_TextUI_TestRunner->doRun() /var/www/html/lib/Cake/TestSuite/CakeTestRunner.php:60 0.2334 2521736 8. PHPUnit_Framework_TestSuite->r
警告:无法为“ catalog_items”创建夹具“ SQLSTATE [42S01]:基表或视图已存在:1050表't_catalog_items'已存在”,位于/var/www/html/lib/Cake/TestSuite/Fixture/CakeTestFixture.php第244行调用堆栈:0.0018 262208 1. {main}()/var/www/html/app/webroot/test.php:0 0.1119 1133560 2. CakeTestSuiteDispatcher :: run()/ var / www / html / app / webroot /test.php:97 0.1120 1133968 3. CakeTestSuiteDispatcher-> dispatch()/var/www/html/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php:113 0.1205 1278304 4. CakeTestSuiteDispatcher-> _ runTestCase()/ var / www / html /lib/Cake/TestSuite/CakeTestSuiteDispatcher.php:96 0.1314 1320376 5. CakeTestSuiteCommand-> run()/var/www/html/lib/Cake/TestSuite/CakeTestSuiteDispatcher.php:253 0.1930 2144664 6. CakeTestRunner-> doRun() /var/www/html/lib/Cake/TestSuite/CakeTestSuiteCommand.php:96 0.2285 2481368 7. PHPUnit_TextUI_TestRunner-> doRun()/var/www/html/lib/Cake/TestSuite/CakeTestRunner.php:60 0.2334 2521736 8。 PHPUnit_Framework_TestSuite-> r un() /var/www/html/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:350 0.2538 2770160 9. PHPUnit_Framework_TestSuite->runTest() /var/www/html/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:749 0.2538 2770288 10. CakeTestCase->run() /var/www/html/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:779 0.2538 2770512 11. CakeFixtureManager->load() /var/www/html/lib/Cake/TestSuite/CakeTestCase.php:80 0.2541 2772984 12. CakeFixtureManager->_setupTable() /var/www/html/lib/Cake/TestSuite/Fixture/CakeFixtureManager.php:234 0.2572 2784752 13. CakeTestFixture->create() /var/www/html/lib/Cake/TestSuite/Fixture/CakeFixtureManager.php:206 0.4597 2824904 14. trigger_error() /var/www/html/lib/Cake/TestSuite/Fixture/CakeTestFixture.php:244
un()/var/www/html/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:350 0.2538 2770160 9. PHPUnit_Framework_TestSuite-> runTest()/ var / www / html / vendor / phpunit / phpunit / PHPUnit / Framework / TestSuite.php:749 0.2538 2770288 10. CakeTestCase-> run()/var/www/html/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:779 0.2538 2770512 11. CakeFixtureManager-> load()/ var / www / html / lib / Cake / TestSuite / CakeTestCase.php:80 0.2541 2772984 12. CakeFixtureManager-> _ setupTable()/var/www/html/lib/Cake/TestSuite/Fixture/CakeFixtureManager.php:234 0.2572 2784752 13 CakeTestFixture-> create()/var/www/html/lib/Cake/TestSuite/Fixture/CakeFixtureManager.php:206 0.4597 2824904 14. trigger_error()/ var / www / html / lib / Cake / TestSuite / Fixture / CakeTestFixture .php:244
The documentation says: 该文件说:
TRUNCATE cannot be used on a table that has foreign-key references from other tables, unless all such tables are also truncated in the same command.
不能在具有来自其他表的外键引用的表上使用TRUNCATE,除非所有这些表在同一命令中也被截断。
So that's what you'll have to do. 这就是您必须要做的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.