Yii database migration

0
1535
views

In this section, will explain database migration in Yii 1.

Yii supports database migration via the yiic migrate command line tool.

In command line, go to folder protected. Then run following command.
php yiic migrate --help

The result will be like this

We will make migrate to table users.
php yiic migrate create_table_users

The new file should be placed in protected/migrations, in example “m170519_075634_table_users.php“. Then update the file.

Run the following command.
php yiic migrate

To drop,
php yii yiic migrate down

Reference :
http://www.yiiframework.com/doc/guide/1.1/en/database.migration
http://www.yiiframework.com/doc/api/1.1/CDbMigration/
https://github.com/redzjovi/yii1tutorial/commit/592d25c2a99b13fd137e3cda2b43468e781f1d91

LEAVE A REPLY

Please enter your name here
Please enter your comment!