Skip to content

Commit a041dd2

Browse files
feat: method to create metadata
1 parent e629078 commit a041dd2

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/Database/Database.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,21 @@ public function getDefaultDatabase(): string
241241
public function create(string $name): bool
242242
{
243243
$this->adapter->create($name);
244-
245-
// Temporarily change defaultDatabase to create metadata collection
246-
$defaultDatabase = $this->getDefaultDatabase();
247-
248244
$this->setDefaultDatabase($name);
245+
$this->createMetadata();
246+
247+
return true;
248+
}
249249

250+
/**
251+
* Create Metadata collection.
252+
* @return bool
253+
* @throws LimitException
254+
* @throws AuthorizationException
255+
* @throws StructureException
256+
*/
257+
public function createMetadata(): bool
258+
{
250259
/**
251260
* Create array of attribute documents
252261
* @var Document[] $attributes
@@ -265,7 +274,6 @@ public function create(string $name): bool
265274
]);
266275

267276
$this->createCollection(self::METADATA, $attributes);
268-
$this->setDefaultDatabase($defaultDatabase);
269277

270278
return true;
271279
}

0 commit comments

Comments
 (0)