forked from doctrine/dbal
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 3.6.x: Fix incorrect syntax for dropping primary indexes in PostgreSQL (doctrine#6025) trigger if called outside for AbstractPlatform::supportsCreateDropDatabase (doctrine#6064) Run tests with PHP 8.3 (doctrine#6060)
- Loading branch information
Showing
5 changed files
with
133 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace Doctrine\DBAL\Tests\Functional\Driver; | ||
|
||
use Doctrine\DBAL\Schema\Table; | ||
use Doctrine\DBAL\Tests\FunctionalTestCase; | ||
use Doctrine\DBAL\Tests\TestUtil; | ||
|
||
class DBAL6024Test extends FunctionalTestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
if (TestUtil::isDriverOneOf('pdo_pgsql', 'pgsql')) { | ||
return; | ||
} | ||
|
||
self::markTestSkipped('This test requires the pdo_pgsql or the pgsql driver.'); | ||
} | ||
|
||
public function testDropPrimaryKey(): void | ||
{ | ||
$table = new Table('mytable'); | ||
$table->addColumn('id', 'integer'); | ||
$table->setPrimaryKey(['id']); | ||
$this->dropAndCreateTable($table); | ||
|
||
$newTable = clone $table; | ||
$newTable->dropPrimaryKey(); | ||
|
||
$schemaManager = $this->connection->createSchemaManager(); | ||
$diff = $schemaManager->createComparator()->compareTables($table, $newTable); | ||
|
||
$statements = $this->connection->getDatabasePlatform()->getAlterTableSQL($diff); | ||
foreach ($statements as $statement) { | ||
$this->connection->executeStatement($statement); | ||
} | ||
|
||
$validationSchema = $schemaManager->introspectSchema(); | ||
$validationTable = $validationSchema->getTable($table->getName()); | ||
|
||
$this->assertNull($validationTable->getPrimaryKey()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters