CakePHP:尝试生成架构时出错

前端之家收集整理的这篇文章主要介绍了CakePHP:尝试生成架构时出错前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我正在尝试开始使用CakePHP架构:app / Console / cake架构生成

我收到以下错误

Welcome to CakePHP v2.3.0 Console
---------------------------------------------------------------
App : app
Path: /Applications/MAMP/htdocs/mysite/app/
---------------------------------------------------------------
Cake Schema Shell
---------------------------------------------------------------
Error: Database connection "MysqL" is missing,or could not be created.

这很令人困惑,因为站点运行正常,因此Config / database.PHP中的DB凭据是正确的.

更新:
因为我正在使用MAMP,所以我在$defualt数组中的Config / database.PHP添加了以下内容

'unix_socket' => '/Applications/MAMP/tmp/MysqL/MysqL.sock',

现在我没有得到原始错误,而是一些新错误

Welcome to CakePHP v2.3.0 Console
---------------------------------------------------------------
App : app
Path: /Applications/MAMP/htdocs/mysite/app/
---------------------------------------------------------------
Cake Schema Shell
---------------------------------------------------------------
Generating Schema...
Notice Error: Schema generation error: invalid column type enum('normal','unlimited_time','admin','extra_time') for Attempt.type does not exist in DBO in [/Applications/MAMP/htdocs/mysite/lib/Cake/Model/CakeSchema.PHP,line 616]

Notice Error: Schema generation error: invalid column type enum('in_progress','complete','canceled') for Attempt.status does not exist in DBO in [/Applications/MAMP/htdocs/mysite/lib/Cake/Model/CakeSchema.PHP,line 616]

Notice Error: Schema generation error: invalid column type enum('MC','FI','CS','CQ','TF') for AttemptedQuestion.type does not exist in DBO in [/Applications/MAMP/htdocs/mysite/lib/Cake/Model/CakeSchema.PHP,line 616]

Notice Error: Schema generation error: invalid column type enum('1','2','3') for Category.category_order does not exist in DBO in [/Applications/MAMP/htdocs/mysite/lib/Cake/Model/CakeSchema.PHP,line 616]

Error: Table choices for model Choice was not found in datasource default.
#0 /Applications/MAMP/htdocs/mysite/lib/Cake/Model/Model.PHP(3217): Model->setSource('choices')
#1 /Applications/MAMP/htdocs/mysite/lib/Cake/Model/CakeSchema.PHP(260): Model->getDataSource()
#2 /Applications/MAMP/htdocs/mysite/lib/Cake/Console/Command/SchemaShell.PHP(149): CakeSchema->read(Array)
#3 /Applications/MAMP/htdocs/mysite/lib/Cake/Console/Shell.PHP(388): SchemaShell->generate()
#4 /Applications/MAMP/htdocs/mysite/lib/Cake/Console/ShellDispatcher.PHP(199): Shell->runCommand('generate',Array)
#5 /Applications/MAMP/htdocs/mysite/lib/Cake/Console/ShellDispatcher.PHP(67): ShellDispatcher->dispatch()
#6 /Applications/MAMP/htdocs/mysite/app/Console/cake.PHP(33): ShellDispatcher::run(Array)
#7 {main}

看起来像CakePHP对ENUM领域感到害怕.

最佳答案
正如这里所描述的那样明确……

Cakephp + enum support : unable to save or select enum 0 and 1

… CakePHP不喜欢ENUM字段.看起来与架构相关的控制台工具将在那里与它们一起使用.

猜你在找的MySQL相关文章