Merge pull request #8728 from appwrite/fix-delete-project

Ignore junction tables
This commit is contained in:
Christy Jacob 2024-09-30 15:26:22 +04:00 committed by GitHub
commit d31810d08b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -503,7 +503,18 @@ class Deletes extends Action
foreach ($collections as $collection) {
if ($dsn->getHost() !== System::getEnv('_APP_DATABASE_SHARED_TABLES', '') || !\in_array($collection->getId(), $projectCollectionIds)) {
$dbForProject->deleteCollection($collection->getId());
try {
$dbForProject->deleteCollection($collection->getId());
} catch (Throwable $e) {
Console::error('Error deleting '.$collection->getId().' '.$e->getMessage());
/**
* Ignore junction tables;
*/
if (!preg_match('/^_\d+_\d+$/', $collection->getId())) {
throw $e;
}
}
} else {
$this->deleteByGroup($collection->getId(), [], database: $dbForProject);
}