Reputation: 3214
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.
Upvotes: 4
Views: 2666
Reputation: 625
In yii2 format
Example: In migration file
$this->addCommentOnColumn('user','role_id','Relation table of role');
Upvotes: 5
Reputation: 3214
Ok, it was pretty straightforward:
$this->createTable('order',[
'user_margin_user_id' => 'INT(32) DEFAULT \'0\' COMMENT "EXPLAINING COMMENT"',
], 'ENGINE=InnoDB CHARSET=utf8');
Upvotes: 1