mirror of
https://github.com/appwrite/appwrite
synced 2026-05-14 20:48:45 +00:00
Merge pull request #4429 from appwrite/fix-4427-database-delete
Only delete collection data for correct db
This commit is contained in:
commit
bbafadcbf6
2 changed files with 11 additions and 3 deletions
|
|
@ -1,3 +1,8 @@
|
|||
# Version 1.0.3
|
||||
## Bugs
|
||||
- Fix document audit deletion [#4429](https://github.com/appwrite/appwrite/pull/4429)
|
||||
- Fix attribute, index, and audit deletion [#4429](https://github.com/appwrite/appwrite/pull/4429)
|
||||
|
||||
# Version 1.0.2
|
||||
## Bugs
|
||||
- Fixed nullable values in functions variables [#3885](https://github.com/appwrite/appwrite/pull/3885)
|
||||
|
|
|
|||
|
|
@ -193,21 +193,24 @@ class DeletesV1 extends Worker
|
|||
protected function deleteCollection(Document $document, string $projectId): void
|
||||
{
|
||||
$collectionId = $document->getId();
|
||||
$databaseId = str_replace('database_', '', $document->getCollection());
|
||||
$databaseId = $document->getAttribute('databaseId');
|
||||
$databaseInternalId = $document->getAttribute('databaseInternalId');
|
||||
|
||||
$dbForProject = $this->getProjectDB($projectId);
|
||||
|
||||
$dbForProject->deleteCollection('database_' . $databaseId . '_collection_' . $document->getInternalId());
|
||||
$dbForProject->deleteCollection('database_' . $databaseInternalId . '_collection_' . $document->getInternalId());
|
||||
|
||||
$this->deleteByGroup('attributes', [
|
||||
Query::equal('databaseId', [$databaseId]),
|
||||
Query::equal('collectionId', [$collectionId])
|
||||
], $dbForProject);
|
||||
|
||||
$this->deleteByGroup('indexes', [
|
||||
Query::equal('databaseId', [$databaseId]),
|
||||
Query::equal('collectionId', [$collectionId])
|
||||
], $dbForProject);
|
||||
|
||||
$this->deleteAuditLogsByResource('collection/' . $collectionId, $projectId);
|
||||
$this->deleteAuditLogsByResource('database/' . $databaseId . '/collection/' . $collectionId, $projectId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue