Fix primary key handling on postgres

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2018-07-27 14:31:19 +02:00
parent 008c8dde1a
commit ef5074adaa
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
1 changed files with 4 additions and 3 deletions

View File

@ -503,12 +503,13 @@ class MigrationService {
$isUsingDefaultName = $indexName === 'primary';
if ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
$defaultName = $table->getName() . '_' . implode('_', $primaryKey->getColumns()) . '_seq';
$defaultName = $table->getName() . '_pkey';
$isUsingDefaultName = strtolower($defaultName) === $indexName;
if ($isUsingDefaultName) {
$sequences = array_filter($sequences, function(Sequence $sequence) use ($indexName) {
return $sequence->getName() !== $indexName;
$sequenceName = $table->getName() . '_' . implode('_', $primaryKey->getColumns()) . '_seq';
$sequences = array_filter($sequences, function(Sequence $sequence) use ($sequenceName) {
return $sequence->getName() !== $sequenceName;
});
}
} else if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) {