Permalink
Browse files

Merge pull request #375 from flip111/patch-1

Update SQLServerPlatform.php by adding methods related to schema.
  • Loading branch information...
2 parents e0ffc8a + f876069 commit 899c98d0d62e0fd34c11ed2e0c17b98bb4b7a849 @guilhermeblanco guilhermeblanco committed Sep 30, 2013
@@ -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) {
@@ -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);
+ }
+ }
}

0 comments on commit 899c98d

Please sign in to comment.