使用$this->addCommentOnTable('{{%my_table}}', 'My comment for table');
Since Yii 2.0.14:
php yii migrate/create create_my_table_table --comment='My comment for table'
或
php yii migrate/create create_my_table_table -C='My comment for table'
生成结果如下:
public function safeUp(): bool
{
$this->createTable('{{%my_table}}', [
'id' => $this->primaryKey(),
]);
$this->addCommentOnTable('{{%my_table}}', 'My comment for table');
}