1
0
Fork 0
mirror of synced 2024-06-01 18:39:57 +12:00

Added method to delete complete namespace

This commit is contained in:
eldadfux 2019-08-22 23:42:06 +03:00
parent 02c6d478d3
commit 2d0ace7cd5

View file

@ -404,6 +404,39 @@ class MySQL extends Adapter
return true;
}
/**
* Delete Namespace
*
* @param $namespace
* @throws Exception
* @return bool
*/
public function deleteNamespace($namespace)
{
if(empty($namespace)) {
throw new Exception('Empty namespace');
}
$documents = 'app_' . $namespace . '.database.documents';
$properties = 'app_' . $namespace . '.database.properties';
$relationships = 'app_' . $namespace . '.database.relationships';
$audit = 'app_' . $namespace . '.audit.audit';
$abuse = 'app_' . $namespace . '.abuse.abuse';
try {
$this->getPDO()->prepare('DROP TABLE `' . $documents . '`;')->execute();
$this->getPDO()->prepare('DROP TABLE `' . $properties . '`;')->execute();
$this->getPDO()->prepare('DROP TABLE `' . $relationships . '`;')->execute();
$this->getPDO()->prepare('DROP TABLE `' . $audit .'`;')->execute();
$this->getPDO()->prepare('DROP TABLE `' . $abuse . '`;')->execute();
}
catch (Exception $e) {
throw $e;
}
return true;
}
/**
* Get Collection
*