1
0
Fork 0
mirror of synced 2024-10-02 10:16:27 +13:00

Clean up attributes to be deleted

This commit is contained in:
Jake Barnby 2023-08-22 19:36:46 -04:00
parent 41faa7420f
commit e15a9ac280
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -39,21 +39,8 @@ class V19 extends Migration
Console::info('Migrating Documents');
$this->forEachDocument([$this, 'fixDocument']);
try {
$this->projectDB->deleteAttribute('projects', 'domains');
$this->projectDB->deleteCachedCollection('projects');
} catch (\Throwable $th) {
Console::warning("'domains' from projects: {$th->getMessage()}");
}
try {
$this->projectDB->deleteAttribute('functions', 'schedule');
$this->projectDB->deleteCachedCollection('functions');
} catch (\Throwable $th) {
Console::warning("'schedule' from functions: {$th->getMessage()}");
}
// TODO: delete builds stderr and stdout
Console::log('Cleaning Up Collections');
$this->cleanCollections();
}
/**
@ -124,6 +111,7 @@ class V19 extends Migration
} catch (\Throwable $th) {
Console::warning("'collectionInternalId' from {$id}: {$th->getMessage()}");
}
try {
$this->createAttributeFromCollection($this->projectDB, $id, 'error');
} catch (\Throwable $th) {
@ -654,4 +642,37 @@ class V19 extends Migration
return $document;
}
private function cleanCollections(): void
{
try {
$this->projectDB->deleteAttribute('projects', 'domains');
} catch (\Throwable $th) {
Console::warning("'domains' from projects: {$th->getMessage()}");
}
$this->projectDB->deleteCachedCollection('projects');
try {
$this->projectDB->deleteAttribute('functions', 'schedule');
} catch (\Throwable $th) {
Console::warning("'schedule' from functions: {$th->getMessage()}");
}
$this->projectDB->deleteCachedCollection('functions');
try {
$this->projectDB->deleteAttribute('builds', 'stderr');
} catch (\Throwable $th) {
Console::warning("'stderr' from builds: {$th->getMessage()}");
}
try {
$this->projectDB->deleteAttribute('builds', 'stdout');
} catch (\Throwable $th) {
Console::warning("'stdout' from builds: {$th->getMessage()}");
}
$this->projectDB->deleteCachedCollection('builds');
}
}