Merge branch '1.7.x' into feat-ce-migration

This commit is contained in:
Khushboo Verma
2025-05-13 12:42:29 +05:30
14 changed files with 43 additions and 76 deletions
-18
View File
@@ -782,17 +782,6 @@ return [
'array' => true,
'filters' => [],
],
[
'$id' => ID::custom('search'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 16384,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
],
'indexes' => [
[
@@ -809,13 +798,6 @@ return [
'lengths' => [],
'orders' => [],
],
[
'$id' => ID::custom('_key_search'),
'type' => Database::INDEX_FULLTEXT,
'attributes' => ['search'],
'lengths' => [],
'orders' => [],
],
],
],
+25 -28
View File
@@ -1554,8 +1554,8 @@ return [
'$id' => ID::custom('sourceSize'),
'type' => Database::VAR_INTEGER,
'format' => '',
'size' => 0,
'signed' => true,
'size' => 8,
'signed' => false,
'required' => false,
'default' => null,
'array' => false,
@@ -1594,17 +1594,6 @@ return [
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('search'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 16384,
'signed' => true,
'required' => false,
'default' => null,
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('activate'),
'type' => Database::VAR_BOOLEAN,
@@ -1639,7 +1628,7 @@ return [
'filters' => [],
],
[
'$id' => ID::custom('buildStartAt'),
'$id' => ID::custom('buildStartedAt'),
'type' => Database::VAR_DATETIME,
'format' => '',
'size' => 0,
@@ -1650,7 +1639,7 @@ return [
'filters' => ['datetime'],
],
[
'$id' => ID::custom('buildEndAt'),
'$id' => ID::custom('buildEndedAt'),
'type' => Database::VAR_DATETIME,
'format' => '',
'size' => 0,
@@ -1665,7 +1654,7 @@ return [
'type' => Database::VAR_INTEGER,
'format' => '',
'size' => 0,
'signed' => true,
'signed' => false,
'required' => false,
'default' => null,
'array' => false,
@@ -1675,8 +1664,8 @@ return [
'$id' => ID::custom('buildSize'),
'type' => Database::VAR_INTEGER,
'format' => '',
'size' => 0,
'signed' => true,
'size' => 8,
'signed' => false,
'required' => false,
'default' => null,
'array' => false,
@@ -1686,8 +1675,8 @@ return [
'$id' => ID::custom('totalSize'),
'type' => Database::VAR_INTEGER,
'format' => '',
'size' => 0,
'signed' => true,
'size' => 8,
'signed' => false,
'required' => false,
'default' => null,
'array' => false,
@@ -1764,13 +1753,6 @@ return [
'lengths' => [],
'orders' => [Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_search'),
'type' => Database::INDEX_FULLTEXT,
'attributes' => ['search'],
'lengths' => [],
'orders' => [],
],
[
'$id' => ID::custom('_key_sourceSize'),
'type' => Database::INDEX_KEY,
@@ -1812,13 +1794,21 @@ return [
'attributes' => ['type'],
'lengths' => [32],
'orders' => [Database::ORDER_ASC],
], [
],
[
'$id' => ID::custom('_key_status'),
'type' => Database::INDEX_KEY,
'attributes' => ['status'],
'lengths' => [16],
'orders' => [Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_resourceId_resourceType'),
'type' => Database::INDEX_KEY,
'attributes' => ['resourceId', 'resourceType'],
'lengths' => [],
'orders' => [],
],
],
],
@@ -2490,6 +2480,13 @@ return [
'lengths' => [],
'orders' => [],
],
[
'$id' => '_key_resourceInternalId_resourceType',
'type' => Database::INDEX_KEY,
'attributes' => ['resourceInternalId', 'resourceType'],
'lengths' => [],
'orders' => [],
],
],
],
];
+1 -1
View File
@@ -311,7 +311,7 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg
'$id' => ID::custom('screenshots'),
'$collection' => ID::custom('buckets'),
'name' => 'Screenshots',
'maximumFileSize' => 5000000, // ~5MB
'maximumFileSize' => 20000000, // ~20MB
'allowedFileExtensions' => [ 'png' ],
'enabled' => true,
'compression' => Compression::GZIP,
@@ -236,7 +236,6 @@ class Create extends Action
'sourcePath' => $path,
'sourceSize' => $fileSize,
'totalSize' => $fileSize,
'search' => implode(' ', [$deploymentId, $entrypoint]),
'activate' => $activate,
'sourceMetadata' => $metadata,
'type' => $type
@@ -276,7 +275,6 @@ class Create extends Action
'totalSize' => $fileSize,
'sourceChunksTotal' => $chunks,
'sourceChunksUploaded' => $chunksUploaded,
'search' => implode(' ', [$deploymentId, $entrypoint]),
'activate' => $activate,
'sourceMetadata' => $metadata,
'type' => $type
@@ -105,8 +105,8 @@ class Create extends Action
'entrypoint' => $function->getAttribute('entrypoint'),
'buildCommands' => $function->getAttribute('commands', ''),
'search' => implode(' ', [$deploymentId, $function->getAttribute('entrypoint')]),
'buildStartAt' => null,
'buildEndAt' => null,
'buildStartedAt' => null,
'buildEndedAt' => null,
'buildDuration' => null,
'buildSize' => null,
'status' => 'waiting',
@@ -87,12 +87,12 @@ class Update extends Action
throw new Exception(Exception::BUILD_ALREADY_COMPLETED);
}
$startTime = new \DateTime($deployment->getAttribute('buildStartAt', 'now'));
$startTime = new \DateTime($deployment->getAttribute('buildStartedAt', 'now'));
$endTime = new \DateTime('now');
$duration = $endTime->getTimestamp() - $startTime->getTimestamp();
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment->setAttributes([
'buildEndAt' => DateTime::now(),
'buildEndedAt' => DateTime::now(),
'buildDuration' => $duration,
'status' => 'canceled'
]));
@@ -263,7 +263,7 @@ class Builds extends Action
$deploymentId = $deployment->getId();
$deployment->setAttribute('buildStartAt', $startTime);
$deployment->setAttribute('buildStartedAt', $startTime);
$deployment->setAttribute('status', 'processing');
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment);
@@ -794,8 +794,8 @@ class Builds extends Action
$executor->deleteRuntime($project->getId(), $deployment->getId(), '-build');
/** Update the build document */
$deployment->setAttribute('buildStartAt', DateTime::format((new \DateTime())->setTimestamp(floor($response['startTime']))));
$deployment->setAttribute('buildEndAt', $endTime);
$deployment->setAttribute('buildStartedAt', DateTime::format((new \DateTime())->setTimestamp(floor($response['startTime']))));
$deployment->setAttribute('buildEndedAt', $endTime);
$deployment->setAttribute('buildDuration', \intval(\ceil($durationEnd - $durationStart)));
$deployment->setAttribute('buildPath', $response['path']);
$deployment->setAttribute('buildSize', $response['size']);
@@ -1163,7 +1163,7 @@ class Builds extends Action
$endTime = DateTime::now();
$durationEnd = \microtime(true);
$deployment->setAttribute('buildEndAt', $endTime);
$deployment->setAttribute('buildEndedAt', $endTime);
$deployment->setAttribute('buildDuration', \intval(\ceil($durationEnd - $durationStart)));
$deployment->setAttribute('status', 'failed');
$deployment->setAttribute('buildLogs', $message);
@@ -81,7 +81,6 @@ class Create extends Action
'name' => $name,
'expire' => $expire,
'sdks' => [],
'search' => implode('', [$name, $project->getId(), $devKeyId]),
'accessedAt' => null,
'secret' => \bin2hex(\random_bytes(128)),
]);
@@ -71,8 +71,7 @@ class Update extends Action
$key
->setAttribute('name', $name)
->setAttribute('expire', $expire)
->setAttribute('search', implode('', [$name, $project->getId(), $key->getId()]));
->setAttribute('expire', $expire);
$dbForPlatform->updateDocument('devKeys', $key->getId(), $key);
@@ -16,7 +16,6 @@ use Utopia\Database\Query;
use Utopia\Database\Validator\UID;
use Utopia\Platform\Action;
use Utopia\Platform\Scope\HTTP;
use Utopia\Validator\Text;
class XList extends Action
{
@@ -52,13 +51,12 @@ class XList extends Action
))
->param('projectId', '', new UID(), 'Project unique ID.')
->param('queries', [], new DevKeys(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', DevKeys::ALLOWED_ATTRIBUTES), true)
->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true)
->inject('response')
->inject('dbForPlatform')
->callback([$this, 'action']);
}
public function action(string $projectId, ?array $queries, ?string $search, Response $response, Database $dbForPlatform)
public function action(string $projectId, ?array $queries, Response $response, Database $dbForPlatform)
{
$project = $dbForPlatform->getDocument('projects', $projectId);
@@ -73,10 +71,6 @@ class XList extends Action
throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage());
}
if (!empty($search)) {
$queries[] = Query::search('search', $search);
}
$queries[] = Query::equal('projectInternalId', [$project->getInternalId()]);
$keys = $dbForPlatform->find('devKeys', $queries);
@@ -247,7 +247,6 @@ class Create extends Action
'sourcePath' => $path,
'sourceSize' => $fileSize,
'totalSize' => $fileSize,
'search' => implode(' ', [$deploymentId]),
'activate' => $activate,
'sourceMetadata' => $metadata,
'type' => $type,
@@ -316,7 +315,6 @@ class Create extends Action
'totalSize' => $fileSize,
'sourceChunksTotal' => $chunks,
'sourceChunksUploaded' => $chunksUploaded,
'search' => implode(' ', [$deploymentId]),
'activate' => $activate,
'sourceMetadata' => $metadata,
'type' => $type,
@@ -123,8 +123,8 @@ class Create extends Action
'search' => implode(' ', [$deploymentId]),
'screenshotLight' => '',
'screenshotDark' => '',
'buildStartAt' => null,
'buildEndAt' => null,
'buildStartedAt' => null,
'buildEndedAt' => null,
'buildDuration' => 0,
'buildSize' => 0,
'status' => 'waiting',
@@ -85,12 +85,12 @@ class Update extends Action
throw new Exception(Exception::BUILD_ALREADY_COMPLETED);
}
$startTime = new \DateTime($deployment->getAttribute('buildStartAt', 'now'));
$startTime = new \DateTime($deployment->getAttribute('buildStartedAt', 'now'));
$endTime = new \DateTime('now');
$duration = $endTime->getTimestamp() - $startTime->getTimestamp();
$deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment->setAttributes([
'buildEndAt' => DateTime::now(),
'buildEndedAt' => DateTime::now(),
'buildDuration' => $duration,
'status' => 'canceled'
]));
@@ -616,9 +616,9 @@ class RealtimeConsoleClientTest extends Scope
$this->assertEquals('building', $response['data']['payload']['status']);
if (!empty($response['data']['payload']['buildEndAt'])) {
$this->assertNotEmpty($response['data']['payload']['buildEndAt']);
$this->assertNotEmpty($response['data']['payload']['buildStartAt']);
if (!empty($response['data']['payload']['buildEndedAt'])) {
$this->assertNotEmpty($response['data']['payload']['buildEndedAt']);
$this->assertNotEmpty($response['data']['payload']['buildStartedAt']);
$this->assertNotEmpty($response['data']['payload']['buildDuration']);
$this->assertNotEmpty($response['data']['payload']['buildPath']);
$this->assertNotEmpty($response['data']['payload']['buildSize']);