src/Phinx/Db/Adapter/SqlServerAdapter.php
protected function getColumnSqlDefinition(Column $column, $create = true)
    {
        $buffer = [];
        if ($column->getType() instanceof Literal) {
            $buffer[] = (string)$column->getType();
        } else {
            $sqlType = $this->getSqlType($column->getType());
            $buffer[] = strtoupper($sqlType['name']);
            // integers cant have limits in SQlServer
            $noLimits = [
                'bigint',
                'int',
                'tinyint'
            ];
            if (!in_array($sqlType['name'], $noLimits) && ($column->getLimit() || isset($sqlType['limit']))) {
                $buffer[] = sprintf('(%s)', $column->getLimit() ? $column->getLimit() : $sqlType['limit']);
            }
        }
        if ($column->getPrecision() && $column->getScale()) {
            $buffer[] = '(' . $column->getPrecision() . ',' . $column->getScale() . ')';
        }

        $properties = $column->getProperties();
        $buffer[] = $column->getType() === 'filestream' ? 'FILESTREAM' : '';
        $buffer[] = isset($properties['rowguidcol']) ? 'ROWGUIDCOL' : '';

        $buffer[] = $column->isNull() ? 'NULL' : 'NOT NULL';

        if ($create === true) {
            if ($column->getDefault() === null && $column->isNull()) {
                $buffer[] = ' DEFAULT NULL';
            } else {
                $buffer[] = $this->getDefaultValueDefinition($column->getDefault());
            }
        }

        if ($column->isIdentity()) {
            $buffer[] = 'IDENTITY(1, 1)';
        }

        return implode(' ', $buffer);
    }
protected function getColumnSqlDefinition(Column $column, $create = true)
    {
        $buffer = [];
        if ($column->getType() instanceof Literal) {
            $buffer[] = (string)$column->getType();
        } else {
            $sqlType = $this->getSqlType($column->getType());
            $buffer[] = strtoupper($sqlType['name']);
            // integers cant have limits in SQlServer
            $noLimits = [
                'bigint',
                'int',
                'tinyint'
            ];
            if (!in_array($sqlType['name'], $noLimits) && ($column->getLimit() || isset($sqlType['limit']))) {
                $buffer[] = sprintf('(%s)', $column->getLimit() ? $column->getLimit() : $sqlType['limit']);
            }
        }
        if ($column->getPrecision() && $column->getScale()) {
            $buffer[] = '(' . $column->getPrecision() . ',' . $column->getScale() . ')';
        }

        $properties = $column->getProperties();
        $buffer[] = $column->getType() === 'filestream' ? 'FILESTREAM' : '';
        $buffer[] = isset($properties['rowguidcol']) ? 'ROWGUIDCOL' : '';

        $buffer[] = $column->isNull() ? 'NULL' : 'NOT NULL';

        if ($create === true) {
            if ($column->getDefault() === null && $column->isNull()) {
                $buffer[] = ' DEFAULT NULL';
            } else {
                $buffer[] = $this->getDefaultValueDefinition($column->getDefault());
            }
        }

        if ($column->isIdentity()) {
            $buffer[] = 'IDENTITY(1, 1)';
        }

        return implode(' ', $buffer);
    }
protected function getColumnSqlDefinition ( Column $ column , $ create = true ) { $ buffer = [ ] ; if ( $ column -> getType ( ) instanceof Literal ) { $ buffer [ ] = ( string ) $ column -> getType ( ) ; } else { $ sqlType = $ this -> getSqlType ( $ column -> getType ( ) ) ; $ buffer [ ] = strtoupper ( $ sqlType [ 'name' ] ) ; // integers cant have limits in SQlServer $ noLimits = [ 'bigint' , 'int' , 'tinyint' ] ; if ( ! in_array ( $ sqlType [ 'name' ] , $ noLimits ) && ( $ column -> getLimit ( ) || isset ( $ sqlType [ 'limit' ] ) ) ) { $ buffer [ ] = sprintf ( '(%s)' , $ column -> getLimit ( ) ? $ column -> getLimit ( ) : $ sqlType [ 'limit' ] ) ; } } if ( $ column -> getPrecision ( ) && $ column -> getScale ( ) ) { $ buffer [ ] = '(' . $ column -> getPrecision ( ) . ',' . $ column -> getScale ( ) . ')' ; } $ properties = $ column -> getProperties ( ) ; $ buffer [ ] = $ column -> getType ( ) === 'filestream' ? 'FILESTREAM' : '' ; $ buffer [ ] = isset ( $ properties [ 'rowguidcol' ] ) ? 'ROWGUIDCOL' : '' ; $ buffer [ ] = $ column -> isNull ( ) ? 'NULL' : 'NOT NULL' ; if ( $ create === true ) { if ( $ column -> getDefault ( ) === null && $ column -> isNull ( ) ) { $ buffer [ ] = ' DEFAULT NULL' ; } else { $ buffer [ ] = $ this -> getDefaultValueDefinition ( $ column -> getDefault ( ) ) ; } } if ( $ column -> isIdentity ( ) ) { $ buffer [ ] = 'IDENTITY(1, 1)' ; } return implode ( ' ' , $ buffer ) ; }
Gets the SqlServer Column Definition for a Column object.

@param \Phinx\Db\Table\Column $column Column
@return string
Gets the SqlServer Column Definition for a Column object .