private function composeAddColumn($name, array $description)
    {
        $type = strtoupper($description['type']);
        $attributes = $description['attributes'];

        // Transform attributes
        $default = $attributes['default'] ?? null;
        $size = $attributes['size'] ?? false;
        $primary = $attributes['primary'] ?? false;
        $increment = $attributes['increment'] ?? false;
        $nullable = $attributes['nullable'] ?? false;
        $unique = $attributes['unique'] ?? false;
        $check = $attributes['check'] ?? false;

        // String to VARCHAR
        if ($type == 'STRING') {
            $type = 'VARCHAR';

            if (!$size) {
                $size = 255;
            }
        }

        // Add column size
        if ($size) {
            $type = sprintf('%s(%s)', $type, $size);
        }

        // Bind auto increment action
        if ($increment) {
            $type = sprintf('%s AUTO_INCREMENT', $type);
        }

        // Set column as primary key
        if ($primary) {
            $type = sprintf('%s PRIMARY KEY', $type);
        }

        // Set column as unique
        if ($unique) {
            $type = sprintf('%s UNIQUE', $type);
        }

        // Add null or not null
        if ($nullable) {
            $type = sprintf('%s NULL', $type);
        } else {
            $type = sprintf('%s NOT NULL', $type);
        }

        // Add default value
        if ($default) {
            $type = sprintf('%s DEFAULT %s', $type, $default);
        }

        if ($check) {
            $type = sprintf('%s CHECK (%s)', $type, $check);
        }

        return trim(
            sprintf('%s `%s` %s', $description['command'], $name, $type)
        );
    }
private function composeAddColumn($name, array $description)
    {
        $type = strtoupper($description['type']);
        $attributes = $description['attributes'];

        // Transform attributes
        $default = $attributes['default'] ?? null;
        $size = $attributes['size'] ?? false;
        $primary = $attributes['primary'] ?? false;
        $increment = $attributes['increment'] ?? false;
        $nullable = $attributes['nullable'] ?? false;
        $unique = $attributes['unique'] ?? false;
        $check = $attributes['check'] ?? false;

        // String to VARCHAR
        if ($type == 'STRING') {
            $type = 'VARCHAR';

            if (!$size) {
                $size = 255;
            }
        }

        // Add column size
        if ($size) {
            $type = sprintf('%s(%s)', $type, $size);
        }

        // Bind auto increment action
        if ($increment) {
            $type = sprintf('%s AUTO_INCREMENT', $type);
        }

        // Set column as primary key
        if ($primary) {
            $type = sprintf('%s PRIMARY KEY', $type);
        }

        // Set column as unique
        if ($unique) {
            $type = sprintf('%s UNIQUE', $type);
        }

        // Add null or not null
        if ($nullable) {
            $type = sprintf('%s NULL', $type);
        } else {
            $type = sprintf('%s NOT NULL', $type);
        }

        // Add default value
        if ($default) {
            $type = sprintf('%s DEFAULT %s', $type, $default);
        }

        if ($check) {
            $type = sprintf('%s CHECK (%s)', $type, $check);
        }

        return trim(
            sprintf('%s `%s` %s', $description['command'], $name, $type)
        );
    }
private function composeAddColumn ( $ name , array $ description ) { $ type = strtoupper ( $ description [ 'type' ] ) ; $ attributes = $ description [ 'attributes' ] ; // Transform attributes $ default = $ attributes [ 'default' ] ?? null ; $ size = $ attributes [ 'size' ] ?? false ; $ primary = $ attributes [ 'primary' ] ?? false ; $ increment = $ attributes [ 'increment' ] ?? false ; $ nullable = $ attributes [ 'nullable' ] ?? false ; $ unique = $ attributes [ 'unique' ] ?? false ; $ check = $ attributes [ 'check' ] ?? false ; // String to VARCHAR if ( $ type == 'STRING' ) { $ type = 'VARCHAR' ; if ( ! $ size ) { $ size = 255 ; } } // Add column size if ( $ size ) { $ type = sprintf ( '%s(%s)' , $ type , $ size ) ; } // Bind auto increment action if ( $ increment ) { $ type = sprintf ( '%s AUTO_INCREMENT' , $ type ) ; } // Set column as primary key if ( $ primary ) { $ type = sprintf ( '%s PRIMARY KEY' , $ type ) ; } // Set column as unique if ( $ unique ) { $ type = sprintf ( '%s UNIQUE' , $ type ) ; } // Add null or not null if ( $ nullable ) { $ type = sprintf ( '%s NULL' , $ type ) ; } else { $ type = sprintf ( '%s NOT NULL' , $ type ) ; } // Add default value if ( $ default ) { $ type = sprintf ( '%s DEFAULT %s' , $ type , $ default ) ; } if ( $ check ) { $ type = sprintf ( '%s CHECK (%s)' , $ type , $ check ) ; } return trim ( sprintf ( '%s `%s` %s' , $ description [ 'command' ] , $ name , $ type ) ) ; }
Compose sql instruction

@param string $name
@param array $description

@return string
Compose sql instruction