fix(executions): stop creating MySQL collection

Remove the project-database executions schema now that ClickHouse is the
only execution store. Keep execution and site-log query validation
independent from the physical MySQL collection definition.

Co-authored-by: Torsten Dittmann <TorstenDittmann@users.noreply.github.com>
This commit is contained in:
Cursor AgentandTorsten Dittmann committed 2026-09-15 09:42:10 +00:00
1 parent 9d75c096fb
commit 6ddb62badf
5 files changed
+44 -283

No files matched your search

-271
View File
@@ -2012,277 +2012,6 @@ return [
],
],
'executions' => [
'$collection' => ID::custom(Database::METADATA),
'$id' => ID::custom('executions'),
'name' => 'Executions',
'attributes' => [
[
'$id' => ID::custom('resourceInternalId'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => Database::LENGTH_KEY,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('resourceId'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => Database::LENGTH_KEY,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('resourceType'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => Database::LENGTH_KEY,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('deploymentInternalId'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => Database::LENGTH_KEY,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('deploymentId'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => Database::LENGTH_KEY,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
[
'array' => false,
'$id' => ID::custom('trigger'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 128,
'signed' => true,
'required' => false,
'default' => null,
'filters' => [],
],
[
'$id' => ID::custom('status'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 128,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('duration'),
'type' => Database::VAR_FLOAT,
'format' => '',
'size' => 0,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('errors'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => APP_FUNCTION_ERROR_LENGTH_LIMIT,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('logs'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => APP_FUNCTION_LOG_LENGTH_LIMIT,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
[
'array' => false,
'$id' => ID::custom('requestMethod'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 128,
'signed' => true,
'required' => false,
'default' => null,
'filters' => [],
],
[
'array' => false,
'$id' => ID::custom('requestPath'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 2048,
'signed' => true,
'required' => false,
'default' => null,
'filters' => [],
],
[
'$id' => ID::custom('requestHeaders'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 16384,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => ['json'],
],
[
'$id' => ID::custom('responseStatusCode'),
'type' => Database::VAR_INTEGER,
'format' => '',
'size' => 0,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('responseHeaders'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 16384,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => ['json'],
],
[
'$id' => ID::custom('scheduledAt'),
'type' => Database::VAR_DATETIME,
'format' => '',
'size' => 0,
'signed' => false,
'required' => false,
'default' => null,
'array' => false,
'filters' => ['datetime'],
],
[
'$id' => ID::custom('scheduleInternalId'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => Database::LENGTH_KEY,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('scheduleId'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => Database::LENGTH_KEY,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
],
'indexes' => [
[
'$id' => ID::custom('_key_resource'),
'type' => Database::INDEX_KEY,
'attributes' => ['resourceInternalId', 'resourceType', 'resourceId'],
'lengths' => [Database::LENGTH_KEY],
'orders' => [Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_trigger'),
'type' => Database::INDEX_KEY,
'attributes' => ['trigger'],
'lengths' => [32],
'orders' => [Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_status'),
'type' => Database::INDEX_KEY,
'attributes' => ['status'],
'lengths' => [32],
'orders' => [Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_requestMethod'),
'type' => Database::INDEX_KEY,
'attributes' => ['requestMethod'],
'lengths' => [128],
'orders' => [Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_requestPath'),
'type' => Database::INDEX_KEY,
'attributes' => ['requestPath'],
'lengths' => [Database::LENGTH_KEY],
'orders' => [Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_deployment'),
'type' => Database::INDEX_KEY,
'attributes' => ['deploymentId'],
'lengths' => [Database::LENGTH_KEY],
'orders' => [Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_responseStatusCode'),
'type' => Database::INDEX_KEY,
'attributes' => ['responseStatusCode'],
'lengths' => [],
'orders' => [Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_duration'),
'type' => Database::INDEX_KEY,
'attributes' => ['duration'],
'lengths' => [],
'orders' => [Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_resourceType'),
'type' => Database::INDEX_KEY,
'attributes' => ['resourceType'],
'lengths' => [],
'orders' => [Database::ORDER_ASC],
],
],
],
'variables' => [
'$collection' => Database::METADATA,
'$id' => 'variables',
@@ -18,22 +18,24 @@ class Base extends Queries
/**
* Expression constructor
*
* @param string $collection
* @param string|array<string, mixed> $collection
* @param string[] $allowedAttributes
* @throws \Exception
*/
public function __construct(string $collection, array $allowedAttributes)
public function __construct(string|array $collection, array $allowedAttributes)
{
$config = Config::getParam('collections', []);
if (\is_string($collection)) {
$config = Config::getParam('collections', []);
$collections = \array_merge(
$config['projects'],
$config['buckets'],
$config['databases'],
$config['console']
);
$collections = \array_merge(
$config['projects'],
$config['buckets'],
$config['databases'],
$config['console']
);
$collection = $collections[$collection];
$collection = $collections[$collection];
}
$allowedAttributesLookup = [];
foreach ($allowedAttributes as $attribute) {
@@ -2,8 +2,20 @@
namespace Appwrite\Utopia\Database\Validator\Queries;
use Utopia\Database\Database;
class Executions extends Base
{
public const ATTRIBUTES = [
['$id' => 'trigger', 'type' => Database::VAR_STRING, 'array' => false],
['$id' => 'status', 'type' => Database::VAR_STRING, 'array' => false],
['$id' => 'responseStatusCode', 'type' => Database::VAR_INTEGER, 'array' => false],
['$id' => 'duration', 'type' => Database::VAR_FLOAT, 'array' => false],
['$id' => 'requestMethod', 'type' => Database::VAR_STRING, 'array' => false],
['$id' => 'requestPath', 'type' => Database::VAR_STRING, 'array' => false],
['$id' => 'deploymentId', 'type' => Database::VAR_STRING, 'array' => false],
];
public const ALLOWED_ATTRIBUTES = [
'trigger',
'status',
@@ -20,6 +32,6 @@ class Executions extends Base
*/
public function __construct()
{
parent::__construct('executions', self::ALLOWED_ATTRIBUTES);
parent::__construct(['attributes' => self::ATTRIBUTES], self::ALLOWED_ATTRIBUTES);
}
}
@@ -19,6 +19,6 @@ class Logs extends Base
*/
public function __construct()
{
parent::__construct('executions', self::ALLOWED_ATTRIBUTES); //TODO: Update this later
parent::__construct(['attributes' => Executions::ATTRIBUTES], self::ALLOWED_ATTRIBUTES);
}
}
+18
View File
@@ -4,7 +4,10 @@ declare(strict_types=1);
namespace Tests\Unit\General;
use Appwrite\Utopia\Database\Validator\Queries\Executions;
use Appwrite\Utopia\Database\Validator\Queries\Logs;
use PHPUnit\Framework\TestCase;
use Utopia\Database\Query;
final class CollectionsTest extends TestCase
{
@@ -33,4 +36,19 @@ final class CollectionsTest extends TestCase
}
}
}
public function testProjectsDoNotDefineExecutionsCollection(): void
{
$this->assertArrayNotHasKey('executions', $this->collections['projects']);
}
public function testExecutionQueryValidatorsDoNotNeedCollectionSchema(): void
{
$this->assertTrue((new Executions())->isValid([
Query::equal('status', ['completed']),
]));
$this->assertTrue((new Logs())->isValid([
Query::equal('status', ['completed']),
]));
}
}