VinceG/PHP-DB-Migration-Class

Not work when more than one migration.

Opened this issue · 0 comments

When I use one migration work fine.
When I use more than one - fatal error.
I call migrate up

PHP DB Migration v1.0

Total 2 new migrations to be applied:
    m140310_153106_test2
    m140310_154809_test3

Apply the above migrations? [yes|no] y
*** applying m140310_153106_test2
*** applied m140310_153106_test2 (time: 0.115s)

*** applying m140310_154809_test3
PHP Fatal error:  Call to a member function prepare() on a non-object in /home/www-data/www/apiservise/app/vendors/migrations/lib/Migration.php on line 301
PHP Stack trace:
PHP   1. {main}() /home/www-data/www/apiservise/app/cli/migrate.php:0
PHP   2. Migration->start() /home/www-data/www/apiservise/app/cli/migrate.php:21
PHP   3. Migration->migrationUp() /home/www-data/www/apiservise/app/vendors/migrations/lib/Migration.php:177
PHP   4. Migration->migrateUp() /home/www-data/www/apiservise/app/vendors/migrations/lib/Migration.php:418
PHP   5. m140310_154809_test3->up() /home/www-data/www/apiservise/app/vendors/migrations/lib/Migration.php:438
PHP   6. MySQLMigration->createTable() /home/www-data/www/apiservise/app/db/migrations/m140310_154809_test3.php:11
PHP   7. Migration->prepare() /home/www-data/www/apiservise/app/vendors/migrations/lib/MySQLMigration.php:144

When I do migrate down 2

PHP DB Migration v1.0

Total 2 migrations to be reverted:
    m140310_154809_test3
    m140310_153106_test2

Revert the above migrations? [yes|no] y
*** reverting m140310_154809_test3
*** reverted m140310_154809_test3 (time: 0.131s)

*** reverting m140310_153106_test2
PHP Fatal error:  Call to a member function prepare() on a non-object in /home/www-data/www/apiservise/app/vendors/migrations/lib/Migration.php on line 301
PHP Stack trace:
PHP   1. {main}() /home/www-data/www/apiservise/app/cli/migrate.php:0
PHP   2. Migration->start() /home/www-data/www/apiservise/app/cli/migrate.php:21
PHP   3. Migration->migrationDown() /home/www-data/www/apiservise/app/vendors/migrations/lib/Migration.php:181
PHP   4. Migration->migrateDown() /home/www-data/www/apiservise/app/vendors/migrations/lib/Migration.php:497
PHP   5. m140310_153106_test2->down() /home/www-data/www/apiservise/app/vendors/migrations/lib/Migration.php:463
PHP   6. MySQLMigration->delete() /home/www-data/www/apiservise/app/db/migrations/m140310_153106_test2.php:18
PHP   7. Migration->prepare() /home/www-data/www/apiservise/app/vendors/migrations/lib/MySQLMigration.php:82

And migrate work only with one migration.