yii\db\Command::addColumn PHP 메소드

addColumn() 공개 메소드

Creates a SQL command for adding a new DB column.
public addColumn ( string $table, string $column, string $type )
$table string the table that the new column will be added to. The table name will be properly quoted by the method.
$column string the name of the new column. The name will be properly quoted by the method.
$type string the column type. [[\yii\db\QueryBuilder::getColumnType()]] will be called to convert the give column type to the physical one. For example, `string` will be converted as `varchar(255)`, and `string not null` becomes `varchar(255) not null`.
    public function addColumn($table, $column, $type)
    {
        $sql = $this->db->getQueryBuilder()->addColumn($table, $column, $type);
        return $this->setSql($sql)->requireTableSchemaRefresh($table);
    }