src/Rentgen/Schema/Manipulation/CreateTableCommand.php
private function getColumnsSql()
    {
        $columnTypeMapper = new ColumnTypeMapper();

        foreach ($this->table->getConstraints() as $constraint) {
            if ($constraint instanceof PrimaryKey) {
                $primaryKey = $constraint;
            }
        }
        if (!isset($primaryKey)) { // TODO find better solution
            $primaryKey = new PrimaryKey();
            $primaryKey->setTable($this->table);
            $this->table->addConstraint($primaryKey);
        }

        $sql = '';
        if (!$primaryKey->isMulti() && $primaryKey->isAutoCreateColumn()) {
            $sql = sprintf('%s %s NOT NULL,', $primaryKey->getColumns(), $primaryKey->isAutoIncrement() ? 'serial' : 'integer');
        }
        foreach ($this->table->getColumns() as $column) {
            if ($column instanceof CustomColumn) {
                $columnType = $column->getType();
            } else {
                $columnType = $columnTypeMapper->getNative($column->getType());
            }

            $sql .= sprintf('%s %s%s %s %s,'
                , $column->getName()
                , $columnType
                , $this->getTypeConstraints($column)
                , $column->isNotNull() ? 'NOT NULL' : ''
                , null === $column->getDefault() ? '' : 'DEFAULT'. ' ' . $this->addQuotesIfNeeded($column, $column->getDefault())
            );
        }

        return rtrim($sql, ',');
    }
private function getColumnsSql()
    {
        $columnTypeMapper = new ColumnTypeMapper();

        foreach ($this->table->getConstraints() as $constraint) {
            if ($constraint instanceof PrimaryKey) {
                $primaryKey = $constraint;
            }
        }
        if (!isset($primaryKey)) { // TODO find better solution
            $primaryKey = new PrimaryKey();
            $primaryKey->setTable($this->table);
            $this->table->addConstraint($primaryKey);
        }

        $sql = '';
        if (!$primaryKey->isMulti() && $primaryKey->isAutoCreateColumn()) {
            $sql = sprintf('%s %s NOT NULL,', $primaryKey->getColumns(), $primaryKey->isAutoIncrement() ? 'serial' : 'integer');
        }
        foreach ($this->table->getColumns() as $column) {
            if ($column instanceof CustomColumn) {
                $columnType = $column->getType();
            } else {
                $columnType = $columnTypeMapper->getNative($column->getType());
            }

            $sql .= sprintf('%s %s%s %s %s,'
                , $column->getName()
                , $columnType
                , $this->getTypeConstraints($column)
                , $column->isNotNull() ? 'NOT NULL' : ''
                , null === $column->getDefault() ? '' : 'DEFAULT'. ' ' . $this->addQuotesIfNeeded($column, $column->getDefault())
            );
        }

        return rtrim($sql, ',');
    }
Gets columns query.

@return string