Merge branch 'feat-db-refactor-ui-fixes' of https://github.com/appwrite/appwrite into feat-db-refactor-ui-fixes
This commit is contained in:
commit
8d326b1b7e
1 changed files with 10 additions and 4 deletions
|
@ -106,12 +106,18 @@ class DatabaseV1 extends Worker
|
||||||
$dbForExternal = $this->getExternalDB($projectId);
|
$dbForExternal = $this->getExternalDB($projectId);
|
||||||
$collectionId = $collection->getId();
|
$collectionId = $collection->getId();
|
||||||
$key = $attribute->getAttribute('key', '');
|
$key = $attribute->getAttribute('key', '');
|
||||||
|
$status = $attribute->getAttribute('status', '');
|
||||||
|
|
||||||
|
// possible states at this point:
|
||||||
|
// - available: should not land in queue; controller flips these to 'deleting'
|
||||||
|
// - processing: hasn't finished creating
|
||||||
|
// - deleting: was available, in deletion queue for first time
|
||||||
|
// - failed: attribute was never created
|
||||||
|
// - stuck: attribute was available but cannot be removed
|
||||||
try {
|
try {
|
||||||
if(!$dbForExternal->deleteAttribute($collectionId, $key) && $attribute->getAttribute('status') !== 'failed') {
|
if($status !== 'failed' && !$dbForExternal->deleteAttribute($collectionId, $key)) {
|
||||||
throw new Exception('Failed to delete Attribute');
|
throw new Exception('Failed to delete Attribute');
|
||||||
}
|
}
|
||||||
|
|
||||||
$dbForInternal->deleteDocument('attributes', $attribute->getId());
|
$dbForInternal->deleteDocument('attributes', $attribute->getId());
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
Console::error($th->getMessage());
|
Console::error($th->getMessage());
|
||||||
|
@ -214,12 +220,12 @@ class DatabaseV1 extends Worker
|
||||||
|
|
||||||
$collectionId = $collection->getId();
|
$collectionId = $collection->getId();
|
||||||
$key = $index->getAttribute('key');
|
$key = $index->getAttribute('key');
|
||||||
|
$status = $index->getAttribute('status', '');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(!$dbForExternal->deleteIndex($collectionId, $key) && $index->getAttribute('status') !== 'failed') {
|
if($status !== 'failed' && !$dbForExternal->deleteIndex($collectionId, $key)) {
|
||||||
throw new Exception('Failed to delete index');
|
throw new Exception('Failed to delete index');
|
||||||
}
|
}
|
||||||
|
|
||||||
$dbForInternal->deleteDocument('indexes', $index->getId());
|
$dbForInternal->deleteDocument('indexes', $index->getId());
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
Console::error($th->getMessage());
|
Console::error($th->getMessage());
|
||||||
|
|
Loading…
Reference in a new issue