Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #375 from flip111/patch-1

Update SQLServerPlatform.php by adding methods related to schema.
  • Loading branch information...
commit 899c98d0d62e0fd34c11ed2e0c17b98bb4b7a849 2 parents e0ffc8a + f876069
Guilherme Blanco guilhermeblanco authored
16 lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View
@@ -166,6 +166,22 @@ public function supportsCreateDropDatabase()
/**
* {@inheritDoc}
*/
+ public function getCreateSchemaSQL($schemaName)
+ {
+ return 'CREATE SCHEMA ' . $schemaName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function schemaNeedsCreation($schemaName)
+ {
+ return $schemaName !== 'dbo';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public function getDropForeignKeySQL($foreignKey, $table)
{
if ($foreignKey instanceof ForeignKeyConstraint) {
19 tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php
View
@@ -317,4 +317,23 @@ protected function getQuotedColumnInForeignKeySQL()
'ALTER TABLE [quoted] ADD CONSTRAINT FK_WITH_INTENDED_QUOTATION FOREIGN KEY ([create], foo, [bar]) REFERENCES [foo-bar] ([create], bar, [foo-bar])',
);
}
+
+ public function testGetCreateSchemaSQL()
+ {
+ $schemaName = 'schema';
+ $sql = $this->_platform->getCreateSchemaSQL($schemaName);
+ $this->assertEquals('CREATE SCHEMA ' . $schemaName, $sql);
+ }
+
+ public function testSchemaNeedsCreation()
+ {
+ $schemaNames = array(
+ 'dbo' => false,
+ 'schema' => true,
+ );
+ foreach ($schemaNames as $name => $expected) {
+ $actual = $this->_platform->schemaNeedsCreation($name);
+ $this->assertEquals($expected, $actual);
+ }
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.