src/Services/PDOs/Schemas/Schema.php
protected function compileFieldType($type, $size, $scale)
    {
        switch (strtolower($type)) {
            case 'smallint':    // 2 Byte
                return 'SMALLINT';

            case 'integer':     // 4 Byte
                return 'INT';

            case 'unsigned':    // 4 Byte
                return 'INT UNSIGNED';

            case 'bigint':      // 8 Byte
                return 'BIGINT';

            case 'numeric':
                return 'NUMERIC(' . ($size ?: 10) . ', ' . ($scale ?: 0) . ')'; // size in digits

            case 'float':
                return 'DOUBLE';

            case 'string':
                return 'VARCHAR(' . ($size ?: 255) . ')'; // size in characters

            case 'text':
            case 'array':  // needs type-hint!
            case 'json':   // needs type-hint!
            case 'object': // needs type-hint!
                return 'TEXT';

            case 'guid':
                return 'UUID'; // PostgreSQL converts to lowercase letters, MSSQL to uppercase!

            case 'binary':
                // size in bytes:
                // 1 Byte  = 2^8-1  = 255 characters
                // 2 Bytes = 2^16-1 = 65535 characters
                // 3 Bytes = 2^24-1 = 16777215 characters
                // 4 Bytes = 2^32-1 = 4294967295 characters
                return 'VARBINARY(' . ($size ?: 2) . ')';

            case 'blob':
                return 'BLOB';

            case 'boolean':
                return 'BOOLEAN';

            case 'date':
                return 'DATE';

            case 'datetime':
                return 'DATETIME';

            case 'timestamp':  // datetime with time zone
                return 'TIMESTAMP';

            case 'time':
                return 'TIME';

            default:
                throw new InvalidArgumentException("Type '{$type}' not supported by Database Access Layer.");
        }
    }
protected function compileFieldType($type, $size, $scale)
    {
        switch (strtolower($type)) {
            case 'smallint':    // 2 Byte
                return 'SMALLINT';

            case 'integer':     // 4 Byte
                return 'INT';

            case 'unsigned':    // 4 Byte
                return 'INT UNSIGNED';

            case 'bigint':      // 8 Byte
                return 'BIGINT';

            case 'numeric':
                return 'NUMERIC(' . ($size ?: 10) . ', ' . ($scale ?: 0) . ')'; // size in digits

            case 'float':
                return 'DOUBLE';

            case 'string':
                return 'VARCHAR(' . ($size ?: 255) . ')'; // size in characters

            case 'text':
            case 'array':  // needs type-hint!
            case 'json':   // needs type-hint!
            case 'object': // needs type-hint!
                return 'TEXT';

            case 'guid':
                return 'UUID'; // PostgreSQL converts to lowercase letters, MSSQL to uppercase!

            case 'binary':
                // size in bytes:
                // 1 Byte  = 2^8-1  = 255 characters
                // 2 Bytes = 2^16-1 = 65535 characters
                // 3 Bytes = 2^24-1 = 16777215 characters
                // 4 Bytes = 2^32-1 = 4294967295 characters
                return 'VARBINARY(' . ($size ?: 2) . ')';

            case 'blob':
                return 'BLOB';

            case 'boolean':
                return 'BOOLEAN';

            case 'date':
                return 'DATE';

            case 'datetime':
                return 'DATETIME';

            case 'timestamp':  // datetime with time zone
                return 'TIMESTAMP';

            case 'time':
                return 'TIME';

            default:
                throw new InvalidArgumentException("Type '{$type}' not supported by Database Access Layer.");
        }
    }
protected function compileFieldType ( $ type , $ size , $ scale ) { switch ( strtolower ( $ type ) ) { case 'smallint' : // 2 Byte return 'SMALLINT' ; case 'integer' : // 4 Byte return 'INT' ; case 'unsigned' : // 4 Byte return 'INT UNSIGNED' ; case 'bigint' : // 8 Byte return 'BIGINT' ; case 'numeric' : return 'NUMERIC(' . ( $ size ? : 10 ) . ', ' . ( $ scale ? : 0 ) . ')' ; // size in digits case 'float' : return 'DOUBLE' ; case 'string' : return 'VARCHAR(' . ( $ size ? : 255 ) . ')' ; // size in characters case 'text' : case 'array' : // needs type-hint! case 'json' : // needs type-hint! case 'object' : // needs type-hint! return 'TEXT' ; case 'guid' : return 'UUID' ; // PostgreSQL converts to lowercase letters, MSSQL to uppercase! case 'binary' : // size in bytes: // 1 Byte  = 2^8-1  = 255 characters // 2 Bytes = 2^16-1 = 65535 characters // 3 Bytes = 2^24-1 = 16777215 characters // 4 Bytes = 2^32-1 = 4294967295 characters return 'VARBINARY(' . ( $ size ? : 2 ) . ')' ; case 'blob' : return 'BLOB' ; case 'boolean' : return 'BOOLEAN' ; case 'date' : return 'DATE' ; case 'datetime' : return 'DATETIME' ; case 'timestamp' : // datetime with time zone return 'TIMESTAMP' ; case 'time' : return 'TIME' ; default : throw new InvalidArgumentException ( "Type '{$type}' not supported by Database Access Layer." ) ; } }
Compile the column type.

This function is used by compileColumnDefinition().

@param string $type by Column type supported by Database Access Layer
@param int|null $size
@param int|null $scale
@return string
Compile the column type .