Yii Migrations

This topic describe how & why we use YII migrations.

anyone describe the difference b/w safeUp and up? same for down and safeDown?

Did you read the descriptions… the difference is explained there - http://www.yiiframework.com/doc/api/1.1/CDbMigration#safeDown-detail

and where we write the renameTable or alter commands? up or down function?

From your question it seems to me you did not read the documentation nor the guide…

Here is all explained about migrations - http://www.yiiframework.com/doc/guide/1.1/en/database.migration#creating-migrations

And if you did not already read it, the best thing to start with Yii and to get the needed understantings is to read the Definitive Guide - http://www.yiiframework.com/doc/guide/1.1/en/index

thanx Domba, thats was great.

but i am wondering about how we UP first two migrations after add new column? like if we have 5 migrations and i want to UP again first two migrations after added new columns.

and also how am i UP/DOWN specific migrations?

you can’t… you can only redo all the last 5 migrations - http://www.yiiframework.com/doc/guide/1.1/en/database.migration#redoing-migrations

but that would first revert all of them and then apply them again.

Migrations are like a queue, they get executed one after another in a series, every new migration counts on all the changes done from those before, so it does not make sense to execute again any previous migration as that one could damage the data that was worked on in later migrations…

All right. Thanx Maurizio Domba.