CakeDC Migrations插件无法初始化schema_migrations表。

时间:2012-09-04 19:56:29

标签: php cakephp migration cakedc

我正在尝试在CakePHP应用中使用https://github.com/CakeDC/migrations插件。安装后,第一步是运行Console/cake Migrations.migration -p Migrations来初始化schema_migrations表。我收到以下错误,告诉我schema_migrations不存在。

Cake Migration Shell
---------------------------------------------------------------
Notice Error: Undefined property: Sqlite::$error in [C:\development\tds\htdocs\app\Plugin\Migrations\Lib\CakeMigration.p
hp, line 419]

Error: Table schema_migrations for model SchemaMigration was not found in datasource default.
#0 C:\development\tds\htdocs\lib\Cake\Model\Model.php(3180): Model->setSource('schema_migratio...')
#1 C:\development\tds\htdocs\lib\Cake\Model\Model.php(2631): Model->getDataSource()
#2 C:\development\tds\htdocs\app\Plugin\Migrations\Lib\MigrationVersion.php(158): Model->find('all', Array)
#3 C:\development\tds\htdocs\app\Plugin\Migrations\Lib\MigrationVersion.php(105): MigrationVersion->getMapping('Migratio
ns')
#4 C:\development\tds\htdocs\app\Plugin\Migrations\Lib\MigrationVersion.php(290): MigrationVersion->setVersion(1, 'Migra
tions', false)
#5 C:\development\tds\htdocs\app\Plugin\Migrations\Lib\MigrationVersion.php(307): MigrationVersion->run(Array)
#6 C:\development\tds\htdocs\app\Plugin\Migrations\Lib\MigrationVersion.php(277): MigrationVersion->resetMigration('Migr
ations')
#7 C:\development\tds\htdocs\app\Plugin\Migrations\Lib\MigrationVersion.php(346): MigrationVersion->run(Array)
#8 C:\development\tds\htdocs\app\Plugin\Migrations\Lib\MigrationVersion.php(68): MigrationVersion->__initMigrations()
#9 C:\development\tds\htdocs\app\Plugin\Migrations\Console\Command\MigrationShell.php(84): MigrationVersion->__construct
(Array)
#10 C:\development\tds\htdocs\lib\Cake\Console\Shell.php(382): MigrationShell->startup()
#11 C:\development\tds\htdocs\lib\Cake\Console\ShellDispatcher.php(201): Shell->runCommand('-p', Array)
#12 C:\development\tds\htdocs\lib\Cake\Console\ShellDispatcher.php(69): ShellDispatcher->dispatch()
#13 C:\development\tds\htdocs\app\Console\cake.php(33): ShellDispatcher::run(Array)
#14 {main}

我正在使用带有SQLite的CakePHP 2.2。

还有其他人遇到过这个问题吗?任何人都知道如何解决它?

2 个答案:

答案 0 :(得分:1)

CakeDC迁移插件主要是为MySQL设计的。我不相信它会在没有经过一些修改的情况下与SQLite一起使用。

答案 1 :(得分:0)

错误不是来自迁移插件:

  

注意错误:未定义属性:Sqlite :: $ error in   [C:\发展\ TDS \ htdocs中\应用\插件\迁移\ LIB \ CakeMigration.p   hp,第419行]

AFAIR CakePHP没有附带SqlLite数据源,所以从哪里获得该数据源,修复它并向其添加错误处理。猜猜它丢失了,因为缺少了错误属性。