Migrate Down With Migrationpath Wont Work Properly

Started a new project in Yii and after I have added the DB tables for authManager and setted up the config, I also added the yii-user module.

The migration for the yii-user went well using the following command:


[gesti@laptop protected]$ ./yiic migrate up --migrationPath=application.modules.user.migrations

After this I have checked that yii-user works and it did. So then just to check if it goes both ways as it should I have issued the command to migrate down, but it doesn’t want to see the yii-user’s migrations.

Here are the commands and out puts:


[gesti@laptop protected]$ ls -l migrations/

total 8

-rw-r--r-- 1 gesti http 402 Jan 12 19:07 m140112_113637_yii_auth_tables.php

-rw-r--r-- 1 gesti http 968 Jan 12 19:07 yii_auth_tables.sql


[gesti@laptop protected]$ ls -l modules/user/migrations/

total 20

-rw-r--r-- 1 gesti http 9537 Jan 12 12:10 m110805_153437_installYiiUser.php

-rw-r--r-- 1 gesti http 5388 Jan 12 12:10 m110810_162301_userTimestampFix.php


[gesti@laptop protected]$ ./yiic migrate history


Yii Migration Tool v1.0 (based on Yii v1.1.15-dev)


Total 4 migrations have been applied before:

    (2014-01-12 19:44:11) m140112_113637_yii_auth_tables

    (2014-01-12 20:25:45) m110810_162301_userTimestampFix

    (2014-01-12 20:25:44) m110805_153437_installYiiUser

    (2014-01-12 12:35:42) m000000_000000_base


[gesti@laptop protected]$ php yiic.php migrate down --migrationPath=application.modules.user.migrations


Yii Migration Tool v1.0 (based on Yii v1.1.15-dev)


Total 1 migration to be reverted:

    m140112_113637_yii_auth_tables


Revert the above migration? (yes|no) [no]:

So my question is this: Am I looking at my screen too close and fail to see a mistake that I’m doing, or there is an undocumented bug in the Yii Migration Tool?

Got it! It was both:

[list=1]

[*]migration down withouth a number after will only migrate down one migration level, so by issuing migrate down 10 shows all my migrations that I could migrate down

[*]and the Yii Migration Tool got a bug as well. When it retrives the migrations from the database it oders it by the version (filename) instead of the apply_time. Due to this it showed my first migration that I wrote in the past days instead of the yii-user migration that I mishamx wrote years ago, but I applied now as second and third migrations.

[/list]

So I’ll be filing a bug report. :)