src/Rentgen/Schema/Info/GetTableCommand.php
public function execute()
    {
        $columnTypeMapper = new ColumnTypeMapper();

        $this->preExecute();
        $columns = $this->connection->query($this->getSql());
        if (empty($columns)) {
            throw new TableNotExistsException($this->tableName);
        }
        $table = new Table($this->tableName);
        if (null === $table->getSchema()) {
            $table->setSchema($columns[0]['table_schema']);
        }
        $columnCreator = new ColumnCreator();
        foreach ($columns as $column) {
            $columnType = $columnTypeMapper->getCommon($column['data_type']);
            $options = array();
            $options['not_null'] = $column['is_nullable'] === 'NO';
            $options['default'] = $column['column_default'];
            if ($columnType === 'string') {
                preg_match("/'(.*)'::character varying/", $column['column_default'], $matches);
                $options['default'] = isset($matches[1]) ? $matches[1] : '';
                $options['limit'] = $column['character_maximum_length'];
            }
            $column = $columnCreator->create($column['column_name'], $columnType, $options);
            $table->addColumn($column);
        }
        $this->loadConstraints($table);
        $this->postExecute();

        return $table;
    }
public function execute()
    {
        $columnTypeMapper = new ColumnTypeMapper();

        $this->preExecute();
        $columns = $this->connection->query($this->getSql());
        if (empty($columns)) {
            throw new TableNotExistsException($this->tableName);
        }
        $table = new Table($this->tableName);
        if (null === $table->getSchema()) {
            $table->setSchema($columns[0]['table_schema']);
        }
        $columnCreator = new ColumnCreator();
        foreach ($columns as $column) {
            $columnType = $columnTypeMapper->getCommon($column['data_type']);
            $options = array();
            $options['not_null'] = $column['is_nullable'] === 'NO';
            $options['default'] = $column['column_default'];
            if ($columnType === 'string') {
                preg_match("/'(.*)'::character varying/", $column['column_default'], $matches);
                $options['default'] = isset($matches[1]) ? $matches[1] : '';
                $options['limit'] = $column['character_maximum_length'];
            }
            $column = $columnCreator->create($column['column_name'], $columnType, $options);
            $table->addColumn($column);
        }
        $this->loadConstraints($table);
        $this->postExecute();

        return $table;
    }
{@inheritdoc}