Commit f2842412 authored by Adrien Crivelli's avatar Adrien Crivelli

[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 b88f2e53
...@@ -491,7 +491,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -491,7 +491,7 @@ class PostgreSqlPlatform extends AbstractPlatform
if ($sequence instanceof \Doctrine\DBAL\Schema\Sequence) { if ($sequence instanceof \Doctrine\DBAL\Schema\Sequence) {
$sequence = $sequence->getQuotedName($this); $sequence = $sequence->getQuotedName($this);
} }
return 'DROP SEQUENCE ' . $sequence; return 'DROP SEQUENCE ' . $sequence . ' CASCADE';
} }
/** /**
......
...@@ -195,7 +195,7 @@ class PostgreSqlPlatformTest extends AbstractPlatformTestCase ...@@ -195,7 +195,7 @@ class PostgreSqlPlatformTest extends AbstractPlatformTestCase
$this->_platform->getCreateSequenceSQL($sequence) $this->_platform->getCreateSequenceSQL($sequence)
); );
$this->assertEquals( $this->assertEquals(
'DROP SEQUENCE myseq', 'DROP SEQUENCE myseq CASCADE',
$this->_platform->getDropSequenceSQL('myseq') $this->_platform->getDropSequenceSQL('myseq')
); );
$this->assertEquals( $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