-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manually merge 2.10.x into 2.11.x #4273
Merged
Merged
Conversation
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
If there is no constraint name defined the listTableForeignKeys should not invent a new one as a numerical id has no deeper meaning and makes schema changes adding information that was not there before. Using `null` is an apropriate value as its already in use when handling not existing fk names.
SQLite: Fix wrongly detected reference constraint name on schema change
This is part of an effort to standardize workflows accross repositories. We do not have a way to do it automatically yet, but it is still nice to have one reference repository.
Reuse global coding standard workflow
Handle both ways of PDO reporting failed connection
This reverts commit f0c1af4.
This reverts commit 85a983c.
…ema change" This reverts commit 7570aeb.
Revert full support for foreign key constraints for SQLite
This looks a bit different from my result (morozov@d26a383):
You can go over each mismatch individually or just use my version. diff --git a/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php b/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php
index a8bbf60ce..26f8583f1 100644
--- a/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php
+++ b/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php
@@ -84,10 +84,6 @@ abstract class AbstractSQLiteDriver implements Driver, ExceptionConverterDriver
return new ConnectionException($message, $exception);
}
- if (strpos($exception->getMessage(), 'FOREIGN KEY constraint failed') !== false) {
- return new ForeignKeyConstraintViolationException($message, $exception);
- }
-
return new DriverException($message, $exception);
}
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
index 65d4c12de..ca17b35db 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
@@ -3,7 +3,6 @@
namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\Common\EventManager;
-use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Events;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\AbstractPlatform;
@@ -265,7 +264,7 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
if ($this->platform->supportsForeignKeyConstraints()) {
self::assertIsString($this->platform->getCreateForeignKeySQL($fk, 'test'));
} else {
- $this->expectException(DBALException::class);
+ $this->expectException(Exception::class);
$this->platform->getCreateForeignKeySQL($fk, 'test');
}
}
diff --git a/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php b/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php
index c40b4a53f..c4e1aca9e 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php
@@ -74,7 +74,7 @@ class CreateSchemaSqlCollectorTest extends TestCase
self::assertSame(['foo'], $this->visitor->getQueries());
}
- public function testAcceptsForeignKeyDoesNotSupportCreateDropForeignKeyConstraints(): void
+ public function testAcceptsForeignKeyDoesNotSupportForeignKeyConstraints(): void
{
$this->platformMock->method('supportsForeignKeyConstraints')
->willReturn(false);
@@ -87,6 +87,19 @@ class CreateSchemaSqlCollectorTest extends TestCase
self::assertEmpty($this->visitor->getQueries());
}
+ public function testAcceptsForeignKeySupportsForeignKeyConstraints(): void
+ {
+ $this->platformMock->method('supportsForeignKeyConstraints')
+ ->willReturn(true);
+
+ $table = $this->createTableMock();
+ $foreignKey = $this->createForeignKeyConstraintMock();
+
+ $this->visitor->acceptForeignKey($table, $foreignKey);
+
+ self::assertSame(['foo'], $this->visitor->getQueries());
+ }
+
public function testAcceptsSequences(): void
{
$sequence = $this->createSequenceMock(); |
morozov
requested changes
Sep 12, 2020
tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php
Show resolved
Hide resolved
morozov
reviewed
Sep 12, 2020
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
Outdated
Show resolved
Hide resolved
morozov
reviewed
Sep 12, 2020
tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php
Show resolved
Hide resolved
I run |
morozov
approved these changes
Sep 12, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Review carefully, I'm not sure I didn't mess up