mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Add migration for version 25 to ensure presenceLogs collection exists; update migration mapping for version 1.9.3. Remove redundant error assertion in PresenceTest.
This commit is contained in:
@@ -95,6 +95,7 @@ abstract class Migration
|
||||
'1.9.0' => 'V24',
|
||||
'1.9.1' => 'V24',
|
||||
'1.9.2' => 'V24',
|
||||
'1.9.3' => 'V25',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Appwrite\Migration\Version;
|
||||
|
||||
use Appwrite\Migration\Migration;
|
||||
use Throwable;
|
||||
use Utopia\Console;
|
||||
use Utopia\Database\Database;
|
||||
|
||||
class V25 extends Migration
|
||||
{
|
||||
public function execute(): void
|
||||
{
|
||||
// Presence logs are only relevant for regular (project) databases.
|
||||
if ($this->project->getSequence() === 'console') {
|
||||
return;
|
||||
}
|
||||
|
||||
$collectionId = 'presenceLogs';
|
||||
|
||||
try {
|
||||
Console::info("Ensuring collection \"{$collectionId}\" exists for project \"{$this->project->getId()}\".");
|
||||
$this->dbForProject->purgeCachedCollection($collectionId);
|
||||
$this->dbForProject->purgeCachedDocument(Database::METADATA, $collectionId);
|
||||
|
||||
$this->createCollection($collectionId);
|
||||
} catch (Throwable $th) {
|
||||
Console::warning("Failed to create collection \"{$collectionId}\": {$th->getMessage()}");
|
||||
|
||||
// Re-throw so the migration fails fast and doesn't leave the system in a partially migrated state.
|
||||
throw $th;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,6 @@ class PresenceTest extends Scope
|
||||
], $payload);
|
||||
|
||||
$this->assertEquals(200, $response['headers']['status-code']);
|
||||
$this->assertArrayNotHasKey('errors', $response['body']);
|
||||
$this->assertEquals('online', $response['body']['data']['presencesUpsert']['status']);
|
||||
$this->assertEquals('graphql', $response['body']['data']['presencesUpsert']['source']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user