Skip to content

Commit

Permalink
Apply fix for migrations on PostgreSQL 10
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffesquivels committed Jun 13, 2018
1 parent 11037b4 commit 1e443cd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,13 @@ protected function _getPortableSequenceDefinition($sequence)
}

if ( ! isset($sequence['increment_by'], $sequence['min_value'])) {
$data = $this->_conn->fetchAssoc('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName));
$version = floatval($this->_conn->getWrappedConnection()->getServerVersion());

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

Expand Down

0 comments on commit 1e443cd

Please sign in to comment.