mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
added backfiling
This commit is contained in:
1 parent
8d1c57d0e7
commit
a2e6106804
1 file changed
+10
@@ -7,6 +7,7 @@ use Exception;
|
||||
use Throwable;
|
||||
use Utopia\Console;
|
||||
use Utopia\Database\Database;
|
||||
use Utopia\Database\Query;
|
||||
|
||||
class V25 extends Migration
|
||||
{
|
||||
@@ -72,6 +73,15 @@ class V25 extends Migration
|
||||
Console::warning("Failed to create attribute \"status\" in collection {$id}: {$th->getMessage()}");
|
||||
}
|
||||
$this->dbForProject->purgeCachedCollection($id);
|
||||
|
||||
// Backfill existing databases so the stored value matches the intended default.
|
||||
foreach ($this->documentsIterator($id, [Query::isNull('status')]) as $database) {
|
||||
try {
|
||||
$this->dbForProject->updateDocument($id, $database->getId(), $database->setAttribute('status', 'ready'));
|
||||
} catch (Throwable $th) {
|
||||
Console::warning("Failed to backfill \"status\" for database {$database->getId()}: {$th->getMessage()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user