1

我正在尝试在我的 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。

有没有其他人遇到过这个问题?谁知道怎么修它?

4

2 回答 2

1

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

于 2012-09-05T00:34:32.230 回答
0

该错误并非来自迁移插件:

注意错误:未定义的属性: [C:\development\tds\htdocs\app\Plugin\Migrations\Lib\CakeMigration.p hp,第 419 行] 中的Sqlite::$error

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

于 2014-03-05T23:54:26.723 回答