mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 00:49:02 +00:00
Delete using Cursor
This commit is contained in:
parent
56a8e38890
commit
6264e616d3
1 changed files with 24 additions and 5 deletions
|
|
@ -505,11 +505,11 @@ class Deletes extends Action
|
|||
$sharedTablesV2 = !$projectTables && !$sharedTablesV1;
|
||||
|
||||
/**
|
||||
* Consider using cursor
|
||||
* @var $dbForProject Database
|
||||
*/
|
||||
$collections = $dbForProject->listCollections(PHP_INT_MAX);
|
||||
|
||||
foreach ($collections as $collection) {
|
||||
var_dump($projectTables);
|
||||
var_dump($projectCollectionIds);
|
||||
$dbForProject->foreach(Database::METADATA, function (Document $collection) use ($dbForProject, $projectTables, $projectCollectionIds) {
|
||||
try {
|
||||
if ($projectTables || !\in_array($collection->getId(), $projectCollectionIds)) {
|
||||
$dbForProject->deleteCollection($collection->getId());
|
||||
|
|
@ -525,7 +525,26 @@ class Deletes extends Action
|
|||
} catch (Throwable $e) {
|
||||
Console::error('Error deleting '.$collection->getId().' '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// $collections = $dbForProject->listCollections(PHP_INT_MAX);
|
||||
// foreach ($collections as $collection) {
|
||||
// try {
|
||||
// if ($projectTables || !\in_array($collection->getId(), $projectCollectionIds)) {
|
||||
// $dbForProject->deleteCollection($collection->getId());
|
||||
// } else {
|
||||
// $this->deleteByGroup(
|
||||
// $collection->getId(),
|
||||
// [
|
||||
// Query::orderAsc()
|
||||
// ],
|
||||
// database: $dbForProject
|
||||
// );
|
||||
// }
|
||||
// } catch (Throwable $e) {
|
||||
// Console::error('Error deleting '.$collection->getId().' '.$e->getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
// Delete Platforms
|
||||
$this->deleteByGroup('platforms', [
|
||||
|
|
|
|||
Loading…
Reference in a new issue