1

I'm trying to use https://github.com/CakeDC/migrations plugin in my CakePHP app. After installing, the first step is to run Console/cake Migrations.migration -p Migrations to initialize the schema_migrations table. I get the following error telling me that schema_migrations does not exist.

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}

I'm using CakePHP 2.2 with SQLite.

Has anyone else run into this problem? Anyone know how to fix it?

Lawrence Barsanti
  • 31,929
  • 10
  • 46
  • 68

2 Answers2

1

The CakeDC migrations plugin was designed primarily for MySQL. I don't believe its going to work with SQLite without some modification.

Predominant
  • 1,460
  • 12
  • 24
0

The error doesn't come from the Migrations plugin:

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

AFAIR CakePHP doesn't come with a SqlLite data source, so from where ever you got that data source, fix it and add the error handling to it. Guess its missing because the error property is missing.

floriank
  • 25,546
  • 9
  • 42
  • 66
  • It does come with a SQLite data source, however, the datasource doesn't support alter statements. That was the root cause of this problem. https://github.com/cakephp/cakephp/tree/master/lib/Cake/Model/Datasource/Database – Lawrence Barsanti Mar 06 '14 at 17:57