Commit 8730afde authored by flip111's avatar flip111 Committed by flip111

Put the responsibility to give the default schema name from...

Put the responsibility to give the default schema name from CreateSchemaSqlCollector to the Platforms (abstract, sqlserver, postgresql)
parent a6f3693d
......@@ -2751,6 +2751,18 @@ abstract class AbstractPlatform
return false;
}
/**
* Returns the default schema name.
*
* @return string
*
* @throws \Doctrine\DBAL\DBALException If not supported on this platform.
*/
protected function getDefaultSchemaName()
{
throw DBALException::notSupported(__METHOD__);
}
/**
* Whether this platform supports create database.
*
......
......@@ -164,6 +164,14 @@ class PostgreSqlPlatform extends AbstractPlatform
return true;
}
/**
* {@inheritdoc}
*/
public function getDefaultSchemaName()
{
return 'public';
}
/**
* {@inheritDoc}
*/
......
......@@ -131,6 +131,14 @@ class SQLServerPlatform extends AbstractPlatform
return true;
}
/**
* {@inheritdoc}
*/
public function getDefaultSchemaName()
{
return 'dbo';
}
/**
* {@inheritDoc}
*/
......
......@@ -23,7 +23,6 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Sequence;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
class CreateSchemaSqlCollector extends AbstractVisitor
{
......@@ -108,12 +107,8 @@ class CreateSchemaSqlCollector extends AbstractVisitor
{
$namespace = $asset->getNamespaceName();
if ($namespace === null) {
if ($this->platform instanceof SQLServerPlatform) {
$namespace = 'dbo';
} else {
$namespace = 'default';
}
if ( !isset($namespace)) {
$namespace = $this->platform->getDefaultSchemaName();
}
if ( !isset($this->createTableQueries[$namespace])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment