/**
* @param Schema $schema
*
* @throws DoctrineStorageException
*/
public function create(Schema $schema)
{
$currentDbSchema = $this->connection->getSchemaManager()->createSchema();
$dbSchema = new DBALSchema($currentDbSchema->getTables(), $currentDbSchema->getSequences(), $this->connection->getSchemaManager()->createSchemaConfig());
foreach ($schema->types() as $type) {
$tableName = $this->tableName($schema->name(), $type->name());
if ($dbSchema->hasTable($tableName)) {
throw DoctrineStorageException::tableAlreadyExists($tableName);
}
$this->createTable($dbSchema, $schema->name(), $type);
}
$queries = $dbSchema->toSql($this->connection->getDatabasePlatform());
$this->executeQueries($queries);
}