Change migration order

Does anybody know how to change the migrations order. I have several migrations and in one of them I use a function that isn’t yet created(will be created in the next migration) so I get an error when calling yiic migrate in cmd

Rename files so number of the first one is less than number of the second.

1 Like

Another way of doing it probably is create a new shell script to call yiic migrate <timestamps> in the order you want it.

When you rename the file, make sure you rename the class inside the file. Also, on those instances where migration has already run, you will have to update the migration table with name and updated (fake) timestamp. I am not sure if updating the migration table is really required, but I would do it anyway just so it all matches up.