jamband\schemadump\SchemaDumpController::otherDefinition PHP Method

otherDefinition() private method

Returns the other definition.
private otherDefinition ( ColumnSchema[] $column ) : string
$column ColumnSchema[]
return string the other definition
    private function otherDefinition($column)
    {
        $definition = '';
        // size
        if ($column->scale !== null && $column->scale > 0) {
            $definition .= "({$column->precision},{$column->scale})";
        } elseif ($column->size !== null && !$column->autoIncrement && $column->dbType !== 'tinyint(1)' || $column->size !== null && $column->unsigned) {
            $definition .= "({$column->size})";
        }
        // unsigned
        if ($column->unsigned) {
            $definition .= ' UNSIGNED';
        }
        // null, auto-increment
        if ($column->allowNull) {
            $definition .= ' NULL';
        } elseif (!$column->autoIncrement) {
            $definition .= ' NOT NULL';
        } elseif ($column->autoIncrement && $column->unsigned) {
            $definition .= ' NOT NULL AUTO_INCREMENT';
        }
        // default value
        if ($column->defaultValue instanceof \yii\db\Expression) {
            $definition .= " DEFAULT {$column->defaultValue}";
        } elseif ($column->defaultValue !== null) {
            $definition .= " DEFAULT '" . addslashes($column->defaultValue) . "'";
        }
        // comment
        if ($column->comment !== '') {
            $definition .= " COMMENT '" . addslashes($column->comment) . "'";
        }
        return $definition;
    }