mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Merge branch '1.6.x' into feat-1.6.x-new-sdk-class
This commit is contained in:
@@ -40,6 +40,7 @@ use Utopia\Database\Query;
|
||||
use Utopia\Database\Validator\Authorization;
|
||||
use Utopia\Database\Validator\Datetime as DatetimeValidator;
|
||||
use Utopia\Database\Validator\Index as IndexValidator;
|
||||
use Utopia\Database\Validator\IndexDependency as IndexDependencyValidator;
|
||||
use Utopia\Database\Validator\Key;
|
||||
use Utopia\Database\Validator\Permissions;
|
||||
use Utopia\Database\Validator\Queries;
|
||||
@@ -2637,6 +2638,18 @@ App::delete('/v1/databases/:databaseId/collections/:collectionId/attributes/:key
|
||||
throw new Exception(Exception::ATTRIBUTE_NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check index dependency
|
||||
*/
|
||||
$validator = new IndexDependencyValidator(
|
||||
$collection->getAttribute('indexes'),
|
||||
$dbForProject->getAdapter()->getSupportForCastIndexArray(),
|
||||
);
|
||||
|
||||
if (! $validator->isValid($attribute)) {
|
||||
throw new Exception(Exception::INDEX_DEPENDENCY);
|
||||
}
|
||||
|
||||
// Only update status if removing available attribute
|
||||
if ($attribute->getAttribute('status') === 'available') {
|
||||
$attribute = $dbForProject->updateDocument('attributes', $attribute->getId(), $attribute->setAttribute('status', 'deleting'));
|
||||
|
||||
Reference in New Issue
Block a user