-
-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag '2.3.0' into merge-2.3.0-into-3.0.x-
- Total issues resolved: **0** - Total pull requests resolved: **6** - Total contributors: **6** - [1032: Let composer decide the best version](#1032) thanks to @PowerKiKi - [1020: Add badges into README about license and packagist](#1020) thanks to @matks - [999: Allow using on PHP 7.1 with Composer 2](#999) thanks to @nicolas-grekas - [981: Add "from-empty-schema" option for "diff" command](#981) thanks to @guilliamxavier - [954: Make compared tables order idempotent](#954) thanks to @julienfalque - [888: Use executeUpdate instead of executeQuery for write operation](#888) thanks to @goetas
- Loading branch information
Showing
9 changed files
with
209 additions
and
9 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
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,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Provider; | ||
|
||
use Doctrine\DBAL\Schema\AbstractSchemaManager; | ||
use Doctrine\DBAL\Schema\Schema; | ||
|
||
/** | ||
* The EmptySchemaProvider class is responsible for creating a Doctrine\DBAL\Schema\Schema instance that | ||
* represents the empty state of your database. | ||
* | ||
* @internal | ||
*/ | ||
final class EmptySchemaProvider implements SchemaProviderInterface | ||
{ | ||
/** @var AbstractSchemaManager */ | ||
private $schemaManager; | ||
|
||
public function __construct(AbstractSchemaManager $schemaManager) | ||
{ | ||
$this->schemaManager = $schemaManager; | ||
} | ||
|
||
public function createSchema() : Schema | ||
{ | ||
return new Schema([], [], $this->schemaManager->createSchemaConfig()); | ||
} | ||
} |
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
46 changes: 46 additions & 0 deletions
46
tests/Doctrine/Migrations/Tests/Provider/EmptySchemaProviderTest.php
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,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Tests\Provider; | ||
|
||
use Doctrine\DBAL\Schema\AbstractSchemaManager; | ||
use Doctrine\DBAL\Schema\SchemaConfig; | ||
use Doctrine\Migrations\Provider\EmptySchemaProvider; | ||
use Doctrine\Migrations\Tests\MigrationTestCase; | ||
use PHPUnit\Framework\MockObject\MockObject; | ||
|
||
/** | ||
* Tests the EmptySchemaProvider. | ||
*/ | ||
class EmptySchemaProviderTest extends MigrationTestCase | ||
{ | ||
/** @var AbstractSchemaManager|MockObject */ | ||
private $schemaManager; | ||
|
||
/** @var EmptySchemaProvider */ | ||
private $emptyProvider; | ||
|
||
public function testCreateSchema() : void | ||
{ | ||
$schemaConfig = new SchemaConfig(); | ||
$schemaConfig->setExplicitForeignKeyIndexes(true); | ||
|
||
$this->schemaManager->expects(self::once()) | ||
->method('createSchemaConfig') | ||
->willReturn($schemaConfig); | ||
|
||
$schema = $this->emptyProvider->createSchema(); | ||
|
||
self::assertSame([], $schema->getTables()); | ||
self::assertSame([], $schema->getSequences()); | ||
self::assertTrue($schema->hasExplicitForeignKeyIndexes()); | ||
self::assertSame([], $schema->getNamespaces()); | ||
} | ||
|
||
protected function setUp() : void | ||
{ | ||
$this->schemaManager = $this->createMock(AbstractSchemaManager::class); | ||
$this->emptyProvider = new EmptySchemaProvider($this->schemaManager); | ||
} | ||
} |