For example, I have table called user in DB which have 3 fields including email, username and password. Now, we want to have some user for testing, you can write down in up() method of Yii migration like following:
class m130726_010519_insert_user extends CDbMigration { public function up() { $this->insert('tbl_user',array( 'email'=>'test1@notanaddress.com', 'username' =>'User One', 'password' => md5('test1'), )); $this->insert('tbl_user',array( 'email'=>'test2@notanaddress.com', 'username' =>'User Two', 'password' => md5('test2'), )); } public function down() { echo "m130726_010519_insert_user does not support migration down.\n"; return false; } }