src/Schema.php
/**
     * Loads the column information into a {@see ColumnSchema} object.
     *
     * @param array $info column information.
     *
     * @return ColumnSchema the column schema object.
     */
Loads the column information into a  ColumnSchema object.
@param array $info column information.

@return ColumnSchema the column schema object.
Loads the column information into a ColumnSchema object . @param array $info column information . @return ColumnSchema the column schema object .
protected function loadColumnSchema(array $info): ColumnSchema
    {
        $column = $this->createColumnSchema();
        $column->name($info['column_name']);
        $column->allowNull($info['is_nullable'] === 'YES');
        $column->dbType($info['data_type']);
        $column->enumValues([]); 
        $column->primaryKey(false); 
        $column->autoIncrement($info['is_identity'] === 1);
        $column->unsigned(stripos($column->getDbType(), 'unsigned') !== false);
        $column->comment($info['comment'] ?? '');
        $column->type(self::TYPE_STRING);
        if (preg_match('/^(\w+)(?:\(([^)]+)\))?/', $column->getDbType(), $matches)) {
            $type = $matches[1];
            if (isset($this->typeMap[$type])) {
                $column->type($this->typeMap[$type]);
            }
            if (!empty($matches[2])) {
                $values = explode(',', $matches[2]);
                $column->precision((int) $values[0]);
                $column->size((int) $values[0]);
                if (isset($values[1])) {
                    $column->scale((int) $values[1]);
                }
                if ($column->getSize() === 1 && ($type === 'tinyint' || $type === 'bit')) {
                    $column->type('boolean');
                } elseif ($type === 'bit') {
                    if ($column->getSize() > 32) {
                        $column->type('bigint');
                    } elseif ($column->getSize() === 32) {
                        $column->type('integer');
                    }
                }
            }
        }
        $column->phpType($this->getColumnPhpType($column));
        if ($info['column_default'] === '(NULL)') {
            $info['column_default'] = null;
        }
        if (!$column->isPrimaryKey() && ($column->getType() !== 'timestamp' || $info['column_default'] !== 'CURRENT_TIMESTAMP')) {
            $column->defaultValue($column->defaultPhpTypecast($info['column_default']));
        }
        return $column;
    }
protected function loadColumnSchema ( array $ info ) : ColumnSchema { $ column = $ this -> createColumnSchema ( ) ; $ column -> name ( $ info [ 'column_name' ] ) ; $ column -> allowNull ( $ info [ 'is_nullable' ] === 'YES' ) ; $ column -> dbType ( $ info [ 'data_type' ] ) ; $ column -> enumValues ( [ ] ) ; $ column -> primaryKey ( false ) ; $ column -> autoIncrement ( $ info [ 'is_identity' ] === 1 ) ; $ column -> unsigned ( stripos ( $ column -> getDbType ( ) , 'unsigned' ) !== false ) ; $ column -> comment ( $ info [ 'comment' ] ?? '' ) ; $ column -> type ( self :: TYPE_STRING ) ; if ( preg_match ( '/^(\w+)(?:\(([^)]+)\))?/' , $ column -> getDbType ( ) , $ matches ) ) { $ type = $ matches [ 1 ] ; if ( isset ( $ this -> typeMap [ $ type ] ) ) { $ column -> type ( $ this -> typeMap [ $ type ] ) ; } if ( ! empty ( $ matches [ 2 ] ) ) { $ values = explode ( ',' , $ matches [ 2 ] ) ; $ column -> precision ( ( int ) $ values [ 0 ] ) ; $ column -> size ( ( int ) $ values [ 0 ] ) ; if ( isset ( $ values [ 1 ] ) ) { $ column -> scale ( ( int ) $ values [ 1 ] ) ; } if ( $ column -> getSize ( ) === 1 && ( $ type === 'tinyint' || $ type === 'bit' ) ) { $ column -> type ( 'boolean' ) ; } elseif ( $ type === 'bit' ) { if ( $ column -> getSize ( ) > 32 ) { $ column -> type ( 'bigint' ) ; } elseif ( $ column -> getSize ( ) === 32 ) { $ column -> type ( 'integer' ) ; } } } } $ column -> phpType ( $ this -> getColumnPhpType ( $ column ) ) ; if ( $ info [ 'column_default' ] === '(NULL)' ) { $ info [ 'column_default' ] = null ; } if ( ! $ column -> isPrimaryKey ( ) && ( $ column -> getType ( ) !== 'timestamp' || $ info [ 'column_default' ] !== 'CURRENT_TIMESTAMP' ) ) { $ column -> defaultValue ( $ column -> defaultPhpTypecast ( $ info [ 'column_default' ] ) ) ; } return $ column ; }
Loads the column information into a {@see ColumnSchema} object.
Loads the column information into a { @see ColumnSchema } object .
// mssql has only vague equivalents to enum // primary key will be determined in findColumns() method