I've no problems with migrations in Yii. But one things bothers me a lot.
I can't manage to add comment to it.
public function safeUp()
{
$this->addColumn('product_supplier', 'type_search', "'INT(1) DEFAULT \'0\'' COMMENT 'field hohohoho' ");
}
In phpmyadmin I used to add comments in such way:
This feature helps a lot to support project.
I would like to be able to do comments in migrations.
Everything what I found is this post:
But I need to add comment in addColumn function. Because I already have the table. Recreating it is not a option because I would lose all data in it.
Maybe someone can guess the proper syntax?
Thanks.
In yii2 format
Example: In migration file
$this->addCommentOnColumn('user','role_id','Relation table of role');
Ok, it was pretty straightforward:
$this->createTable('order',[
'user_margin_user_id' => 'INT(32) DEFAULT \'0\' COMMENT "EXPLAINING COMMENT"',
], 'ENGINE=InnoDB CHARSET=utf8');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With