3

I've got a symfony 2.8 project with a postgressql database and the ID generation strategy is IDENTITY but every command I enter like

doctrine:schema:update

or

doctrine:migrations:migrate

return an error like this:

An exception occurred while executing 'SELECT min_value, increment_by FROM "abstract_group_id_seq"':
SQLSTATE[42703]: Undefined column: 7 ERROR: column "min_value" does not exist
LINE 1: SELECT min_value, increment_by FROM "abstract_group_id_seq"

Is it a schema name problem? Does anybody know how to setup doctrine properly? Thank you.

DevThiman
  • 920
  • 1
  • 9
  • 24
Jul6art
  • 219
  • 3
  • 14

2 Answers2

7

If someone else still has this problem, make sure you are using the correct Postgres driver version in doctrine.yaml

PostgreSQL DBAL

Sorix
  • 850
  • 5
  • 18
2

Change method _getPortableSequenceDefinition() located in file /vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php

to this one:

 protected function _getPortableSequenceDefinition($sequence)
    {
        if ($sequence['schemaname'] != 'public') {
            $sequenceName = $sequence['schemaname'] . "." . $sequence['relname'];
        } else {
            $sequenceName = $sequence['relname'];
        }

        $version = floatval($this->_conn->getWrappedConnection()->getServerVersion());

        if ($version >= 10) {$data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM pg_sequences WHERE schemaname = \'public\' AND sequencename = '.$this->_conn->quote($sequenceName));
        }
        else
        {
            $data = $this->_conn->fetchAll('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName));
        }

        return new Sequence($sequenceName, $data[0]['increment_by'], $data[0]['min_value']);
    }
Peep
  • 135
  • 1
  • 10