yii\db\Migration::addCommentOnColumn PHP Method

addCommentOnColumn() public method

Builds and execute a SQL statement for adding comment to column
Since: 2.0.8
public addCommentOnColumn ( string $table, string $column, string $comment )
$table string the table whose column is to be commented. The table name will be properly quoted by the method.
$column string the name of the column to be commented. The column name will be properly quoted by the method.
$comment string the text of the comment to be added. The comment will be properly quoted by the method.
    public function addCommentOnColumn($table, $column, $comment)
    {
        echo "    > add comment on column {$column} ...";
        $time = microtime(true);
        $this->db->createCommand()->addCommentOnColumn($table, $column, $comment)->execute();
        echo ' done (time: ' . sprintf('%.3f', microtime(true) - $time) . "s)\n";
    }

Usage Example

Example #1
0
 /**
  * @inheritdoc
  * Note: table will be auto pefixied if [[$autoWrapTableNames]] is true.
  * @since 0.3.0
  */
 public function addCommentOnColumn($table, $column, $comment)
 {
     $table = $this->autoWrappedTableName($table);
     return parent::addCommentOnColumn($table, $column, $comment);
 }