Compare commits

...
Author SHA1 Message Date
Torsten Dittmann 05e2a8e3e6 chore: remove unused import 2024-03-13 13:05:32 +01:00
Torsten Dittmann 4cc73ece5c chore: remove unused import 2024-03-13 13:04:56 +01:00
Torsten Dittmann 5c39c1ece4 fix: migration 1.4.x 2024-03-13 13:01:40 +01:00
Jake BarnbyandGitHub 5cfaee4297 Merge pull request #7817 from appwrite/chore-prepare-release
1.4.x
2024-03-13 12:01:32 +01:00
Jake Barnby 63f8800efe Prepare release 2024-03-13 11:15:25 +01:00
Jake BarnbyandGitHub f6fefd82a5 Merge pull request #7816 from appwrite/fix-function-build
Escape function build command
2024-03-13 11:11:53 +01:00
Steven NguyenandJake Barnby 3c8f51768d Escape function build command
The extra trim is neded to because the extra quotes interfere with
additional operations in the executor/orchestration library.
2024-03-13 11:10:25 +01:00
7 changed files with 54 additions and 41 deletions
+6
View File
@@ -1,3 +1,9 @@
# Version 1.4.14
## What's Changed
### Fixes
* Fix function build command by @abnegate in https://github.com/appwrite/appwrite/pull/7816
# Version 1.4.13
## Notable changes
+3 -3
View File
@@ -66,7 +66,7 @@ docker run -it --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
--entrypoint="install" \
appwrite/appwrite:1.4.13
appwrite/appwrite:1.4.14
```
### Windows
@@ -78,7 +78,7 @@ docker run -it --rm ^
--volume //var/run/docker.sock:/var/run/docker.sock ^
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
--entrypoint="install" ^
appwrite/appwrite:1.4.13
appwrite/appwrite:1.4.14
```
#### PowerShell
@@ -88,7 +88,7 @@ docker run -it --rm `
--volume /var/run/docker.sock:/var/run/docker.sock `
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw `
--entrypoint="install" `
appwrite/appwrite:1.4.13
appwrite/appwrite:1.4.14
```
运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。
+3 -3
View File
@@ -76,7 +76,7 @@ docker run -it --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
--entrypoint="install" \
appwrite/appwrite:1.4.13
appwrite/appwrite:1.4.14
```
### Windows
@@ -88,7 +88,7 @@ docker run -it --rm ^
--volume //var/run/docker.sock:/var/run/docker.sock ^
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
--entrypoint="install" ^
appwrite/appwrite:1.4.13
appwrite/appwrite:1.4.14
```
#### PowerShell
@@ -98,7 +98,7 @@ docker run -it --rm `
--volume /var/run/docker.sock:/var/run/docker.sock `
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw `
--entrypoint="install" `
appwrite/appwrite:1.4.13
appwrite/appwrite:1.4.14
```
Once the Docker installation is complete, go to http://localhost to access the Appwrite console from your browser. Please note that on non-Linux native hosts, the server might take a few minutes to start after completing the installation.
+2 -2
View File
@@ -110,8 +110,8 @@ const APP_LIMIT_LIST_DEFAULT = 25; // Default maximum number of items to return
const APP_KEY_ACCCESS = 24 * 60 * 60; // 24 hours
const APP_USER_ACCCESS = 24 * 60 * 60; // 24 hours
const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours
const APP_CACHE_BUSTER = 329;
const APP_VERSION_STABLE = '1.4.13';
const APP_CACHE_BUSTER = 330;
const APP_VERSION_STABLE = '1.4.14';
const APP_DATABASE_ATTRIBUTE_EMAIL = 'email';
const APP_DATABASE_ATTRIBUTE_ENUM = 'enum';
const APP_DATABASE_ATTRIBUTE_IP = 'ip';
+5 -10
View File
@@ -77,7 +77,8 @@ abstract class Migration
'1.4.10' => 'V19',
'1.4.11' => 'V19',
'1.4.12' => 'V19',
'1.4.13' => 'V19'
'1.4.13' => 'V19',
'1.4.14' => 'V19',
];
/**
@@ -200,20 +201,14 @@ abstract class Migration
$sum = 0;
$nextDocument = null;
$collectionCount = $this->projectDB->count($collectionId);
$queries[] = Query::limit($this->limit);
do {
$usedQueries = [...$queries, Query::limit($this->limit)];
if ($nextDocument !== null) {
$cursorQueryIndex = \array_search('cursorAfter', \array_map(fn (Query $query) => $query->getMethod(), $queries));
if ($cursorQueryIndex !== false) {
$queries[$cursorQueryIndex] = Query::cursorAfter($nextDocument);
} else {
$queries[] = Query::cursorAfter($nextDocument);
}
$usedQueries[] = Query::cursorAfter($nextDocument);
}
$documents = $this->projectDB->find($collectionId, $queries);
$documents = $this->projectDB->find($collectionId, $usedQueries);
$count = count($documents);
$sum += $count;
+34 -21
View File
@@ -42,11 +42,6 @@ class V19 extends Migration
Console::info('Migrating Buckets');
$this->migrateBuckets();
if ($this->project->getId() !== 'console') {
Console::info('Migrating Enum Attribute Size');
$this->migrateEnumAttributeSize();
}
Console::info('Migrating Documents');
$this->forEachDocument([$this, 'fixDocument']);
@@ -147,6 +142,40 @@ class V19 extends Migration
// $this->createCollection('statsLogger');
break;
case 'attributes':
/**
* Update all enum attributes to have a size of 255
*/
foreach (
$this->documentsIterator('attributes', [
Query::equal('format', ['enum']),
Query::lessThan('size', Database::LENGTH_KEY)
]) as $attribute
) {
/**
* Migratte attribute document on collection
*/
try {
$attribute->setAttribute('size', Database::LENGTH_KEY);
$this->projectDB->updateDocument('attributes', $attribute->getId(), $attribute);
} catch (\Throwable $th) {
Console::warning("Error migrating attribute {$attribute->getAttribute('key')}: {$th->getMessage()}");
}
/**
* Migrate internal attribute on collections
*/
try {
$databaseInternalId = $attribute->getAttribute('databaseInternalId');
$collectionInternalId = $attribute->getAttribute('collectionInternalId');
$this->projectDB->updateAttribute(
collection: 'database_' . $databaseInternalId . '_collection_' . $collectionInternalId,
id: $attribute->getAttribute('key'),
size: Database::LENGTH_KEY
);
} catch (\Throwable) {
Console::warning("Error migrating internal attribute {$attribute->getAttribute('key')}: {$th->getMessage()}");
}
}
// intentional fallthrough
case 'indexes':
try {
$this->projectDB->updateAttribute($id, 'databaseInternalId', required: true);
@@ -646,22 +675,6 @@ class V19 extends Migration
return $commands;
}
private function migrateEnumAttributeSize(): void
{
foreach (
$this->documentsIterator('attributes', [
Query::equal('format', ['enum']),
Query::lessThan('size', Database::LENGTH_KEY)
]) as $attribute
) {
$attribute->setAttribute('size', Database::LENGTH_KEY);
$this->projectDB->updateDocument('attributes', $attribute->getId(), $attribute);
$databaseInternalId = $attribute->getAttribute('databaseInternalId');
$collectionInternalId = $attribute->getAttribute('collectionInternalId');
$this->projectDB->updateAttribute('database_' . $databaseInternalId . '_collection_' . $collectionInternalId, $attribute->getAttribute('key'), size: 255);
}
}
/**
* Fix run on each document
*
+1 -2
View File
@@ -386,7 +386,6 @@ class Builds extends Action
]);
$command = $deployment->getAttribute('commands', '');
$command = \str_replace('"', '\\"', $command);
$response = null;
$err = null;
@@ -395,7 +394,7 @@ class Builds extends Action
Co\go(function () use ($executor, &$response, $project, $deployment, $source, $function, $runtime, $vars, $command, &$err) {
try {
$version = $function->getAttribute('version', 'v2');
$command = $version === 'v2' ? 'tar -zxf /tmp/code.tar.gz -C /usr/code && cd /usr/local/src/ && ./build.sh' : 'tar -zxf /tmp/code.tar.gz -C /mnt/code && helpers/build.sh "' . $command . '"';
$command = $version === 'v2' ? 'tar -zxf /tmp/code.tar.gz -C /usr/code && cd /usr/local/src/ && ./build.sh' : 'tar -zxf /tmp/code.tar.gz -C /mnt/code && helpers/build.sh "' . \trim(\escapeshellarg($command), "\'") . '"';
$response = $executor->createRuntime(
deploymentId: $deployment->getId(),