Skip to content

Commit 4e85a80

Browse files
authored
Merge pull request #270 from andrew-demb/check-database-platform-option
Support check_database_platform option
2 parents 1a0e8b6 + 0889ebf commit 4e85a80

File tree

5 files changed

+9
-0
lines changed

5 files changed

+9
-0
lines changed

Command/DoctrineCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public static function configureMigrations(ContainerInterface $container, Config
8585
$configuration->setMigrationsColumnLength($container->getParameter('doctrine_migrations.column_length'));
8686
$configuration->setMigrationsExecutedAtColumnName($container->getParameter('doctrine_migrations.executed_at_column_name'));
8787
$configuration->setAllOrNothing($container->getParameter('doctrine_migrations.all_or_nothing'));
88+
$configuration->setCheckDatabasePlatform($container->getParameter('doctrine_migrations.check_database_platform'));
8889

8990
// Migrations is not register from configuration loader
9091
if (! ($configuration instanceof AbstractFileConfiguration)) {

DependencyInjection/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public function getConfigTreeBuilder() : TreeBuilder
5050
->scalarNode('all_or_nothing')->defaultValue(false)->end()
5151
->scalarNode('name')->defaultValue('Application Migrations')->end()
5252
->scalarNode('custom_template')->defaultValue(null)->end()
53+
->scalarNode('check_database_platform')->defaultValue(true)->end()
5354
->scalarNode('organize_migrations')->defaultValue(false)
5455
->info('Organize migrations mode. Possible values are: "BY_YEAR", "BY_YEAR_AND_MONTH", false')
5556
->validate()

Resources/config/schema/doctrine_migrations-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<xsd:attribute name="all_or_nothing" type="xsd:boolean" />
1616
<xsd:attribute name="name" type="xsd:string" />
1717
<xsd:attribute name="custom_template" type="xsd:string" />
18+
<xsd:attribute name="check_database_platform" type="xsd:boolean" />
1819
<xsd:attribute name="organize-migrations">
1920
<xsd:simpleType>
2021
<xsd:restriction base="xsd:string">

Resources/doc/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ application:
5353
# available in version >= 1.3. Path to your custom migrations template
5454
custom_template: ~
5555
all_or_nothing: false
56+
check_database_platform: true
5657
5758
Usage
5859
-----

Tests/Command/DoctrineCommandTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ public function testConfigureMigrations() : void
7272
->method('setAllOrNothing')
7373
->with(false);
7474

75+
$configurationMock->expects($this->once())
76+
->method('setCheckDatabasePlatform')
77+
->with(true);
78+
7579
DoctrineCommand::configureMigrations($this->getContainer(), $configurationMock);
7680
}
7781

@@ -88,6 +92,7 @@ private function getContainer() : ContainerBuilder
8892
'doctrine_migrations.organize_migrations' => Configuration::VERSIONS_ORGANIZATION_BY_YEAR,
8993
'doctrine_migrations.custom_template' => null,
9094
'doctrine_migrations.all_or_nothing' => false,
95+
'doctrine_migrations.check_database_platform' => true,
9196
]));
9297
}
9398
}

0 commit comments

Comments
 (0)