Commit e1c967c2 authored by Adrien Crivelli's avatar Adrien Crivelli Committed by Benjamin Eberlei

[DBAL-54] Cannot drop schema using IDENTITY strategy in PostgreSQL

DBAL-54 was fixed in commit 3d55dc8e by
changing SQL queries order. However it was later reintroduced.

This patch uses a different, more future-proof way, approach by using
DROP SEQUENCE ... CASCADE syntax, and thus does not depend on queries order.
parent 40ebc9d8
......@@ -463,7 +463,7 @@ class PostgreSqlPlatform extends AbstractPlatform
if ($sequence instanceof \Doctrine\DBAL\Schema\Sequence) {
$sequence = $sequence->getQuotedName($this);
}
return 'DROP SEQUENCE ' . $sequence;
return 'DROP SEQUENCE ' . $sequence . ' CASCADE';
}
/**
......
......@@ -155,7 +155,7 @@ class PostgreSqlPlatformTest extends AbstractPlatformTestCase
$this->_platform->getCreateSequenceSQL($sequence)
);
$this->assertEquals(
'DROP SEQUENCE myseq',
'DROP SEQUENCE myseq CASCADE',
$this->_platform->getDropSequenceSQL('myseq')
);
$this->assertEquals(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment