Added method to delete complete namespace
This commit is contained in:
parent
02c6d478d3
commit
2d0ace7cd5
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue