Skip to content

Commit

Permalink
u
Browse files Browse the repository at this point in the history
  • Loading branch information
bohanyang committed Sep 18, 2023
1 parent f56ba50 commit 99e7a81
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/mango/Doctrine/SchemaProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Closure;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Result;
use Doctrine\DBAL\Schema\PostgreSQLSchemaManager;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\Provider\SchemaProvider as SchemaProviderInterface;
use InvalidArgumentException;
Expand Down Expand Up @@ -91,6 +92,14 @@ public function createSchema(): Schema

$schema = new Schema(schemaConfig: $schemaManager->createSchemaConfig());

if ($schemaManager instanceof PostgreSQLSchemaManager) {
foreach ($schemaManager->listSchemaNames() as $namespace) {
if (! $schema->hasNamespace($namespace)) {
$schema->createNamespace($namespace);
}
}
}

foreach ($this->tableBuilders as $tableBuilder) {
$table = new Table($schema->createTable($name = $tableBuilder->getName()));
$tableBuilder->build($table);
Expand Down

0 comments on commit 99e7a81

Please sign in to comment.