CakePHP 3与oracle桌子一起烘烤麻烦

时间:2016-12-03 06:57:18

标签: oracle cakephp

每次烘烤oracle表有下面的问题。有没有人得到任何解决方案。

Exception: Columns used in constraints must be added to the Table schema first. The column "region_id" was not found in table "COUNTRIES". in [C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Database\Schema\Table.php, line 606]
2016-12-03 06:47:03 Error: [Cake\Database\Exception] Columns used in constraints must be added to the Table schema first. The column "region_id" was not found in table "COUNTRIES".
Stack Trace:
#0 C:\xampp\htdocs\production\vendor\cakedc\cakephp-oracle-driver\src\Database\Schema\OracleSchema.php(623): Cake\Database\Schema\Table->addConstraint('COUNTR_REG_FK', Array)
#1 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Database\Schema\Collection.php(134): CakeDC\OracleDriver\Database\Schema\OracleSchema->convertForeignKeyDescription(Object(Cake\Database\Schema\Table), Array)
#2 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Database\Schema\Collection.php(103): Cake\Database\Schema\Collection->_reflect('ForeignKey', 'COUNTRIES', Array, Object(Cake\Database\Schema\Table))
#3 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Database\Schema\CachedCollection.php(63): Cake\Database\Schema\Collection->describe('COUNTRIES', Array)
#4 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\ORM\Table.php(440): Cake\Database\Schema\CachedCollection->describe('COUNTRIES')
#5 C:\xampp\htdocs\production\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(345): Cake\ORM\Table->schema()
#6 C:\xampp\htdocs\production\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(221): Bake\Shell\Task\ModelTask->findHasMany(Object(Cake\ORM\Table), Array)
#7 C:\xampp\htdocs\production\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(127): Bake\Shell\Task\ModelTask->getAssociations(Object(Cake\ORM\Table))
#8 C:\xampp\htdocs\production\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(110): Bake\Shell\Task\ModelTask->getTableContext(Object(Cake\ORM\Table), 'users', 'Users')
#9 C:\xampp\htdocs\production\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(97): Bake\Shell\Task\ModelTask->bake('Users')
#10 [internal function]: Bake\Shell\Task\ModelTask->main('users')
#11 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Console\Shell.php(466): call_user_func_array(Array, Array)
#12 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Console\Shell.php(459): Cake\Console\Shell->runCommand(Array, false, Array)
#13 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(227): Cake\Console\Shell->runCommand(Array, true, Array)
#14 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(182): Cake\Console\ShellDispatcher->_dispatch(Array)
#15 C:\xampp\htdocs\production\vendor\cakephp\cakephp\src\Console\ShellDispatcher.php(128): Cake\Console\ShellDispatcher->dispatch(Array)
#16 C:\xampp\htdocs\production\bin\cake.php(34): Cake\Console\ShellDispatcher::run(Array)
#17 {main}

1 个答案:

答案 0 :(得分:0)

问题已解决,只需修复" SEQUENCE"的命名约定,导致cakephp支持。以下示例,

如果你有一个表名"用户"你的sequnce名称将是" seq_users"。