From d0cfad90852b17a87da6cdf02c760bcf9bad8c10 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Fri, 28 Apr 2023 12:11:41 -0700 Subject: [PATCH 1/2] Prevent migration from overriding existing data For users already on 1.3.1, after upgrading to 1.3.2, the migration script would override existing auths, password history, team prefs, and (relationship) attribute options with empty values. This commit fixes the migration to set to an existing value if there was one. --- CHANGES.md | 9 +++++++-- src/Appwrite/Migration/Version/V18.php | 10 +++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index df4bc7105..84137981c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +# Version 1.3.3 + +## Bugs +- Fixed migration resetting some data [#5455](https://github.com/appwrite/appwrite/pull/5455) + # Version 1.3.2 ## Bugs @@ -8,12 +13,12 @@ # Version 1.3.1 ## Bugs -- Fixed Migration issue regarding 500 error [4906](https://github.com/appwrite/appwrite/pull/5356) +- Fixed Migration issue regarding 500 error [#5356](https://github.com/appwrite/appwrite/pull/5356) # Version 1.3.0 ## Features -- Password dictionary setting allows to compare user's password against command password database [4906](https://github.com/appwrite/appwrite/pull/4906) +- Password dictionary setting allows to compare user's password against command password database [#4906](https://github.com/appwrite/appwrite/pull/4906) - Password history setting allows to save user's last used password so that it may not be used again. Maximum number of history saved is 20, which can be configured. Minimum is 0 which means disabled. [#4866](https://github.com/appwrite/appwrite/pull/4866) - Update APIs to check X-Appwrite-Timestamp header [#5024](https://github.com/appwrite/appwrite/pull/5024) - Database relationships [#5238](https://github.com/appwrite/appwrite/pull/5238) diff --git a/src/Appwrite/Migration/Version/V18.php b/src/Appwrite/Migration/Version/V18.php index 1cbb337c0..e55d62b0c 100644 --- a/src/Appwrite/Migration/Version/V18.php +++ b/src/Appwrite/Migration/Version/V18.php @@ -159,28 +159,28 @@ class V18 extends Migration /** * Set default passwordHistory */ - $document->setAttribute('auths', array_merge($document->getAttribute('auths', []), [ + $document->setAttribute('auths', array_merge([ 'passwordHistory' => 0, 'passwordDictionary' => false, - ])); + ], $document->getAttribute('auths', []))); break; case 'users': /** * Default Password history */ - $document->setAttribute('passwordHistory', []); + $document->setAttribute('passwordHistory', $document->getAttribute('passwordHistory', [])); break; case 'teams': /** * Default prefs */ - $document->setAttribute('prefs', new \stdClass()); + $document->setAttribute('prefs', $document->getAttribute('prefs', new \stdClass())); break; case 'attributes': /** * Default options */ - $document->setAttribute('options', new \stdClass()); + $document->setAttribute('options', $document->getAttribute('options', new \stdClass())); break; } From 1e5dc3ad6ff727ed96b98f1b554a3611707d7255 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Fri, 28 Apr 2023 12:29:46 -0700 Subject: [PATCH 2/2] Bump version to 1.3.3 --- README-CN.md | 6 +++--- README.md | 7 ++++--- app/init.php | 2 +- src/Appwrite/Migration/Migration.php | 1 + 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README-CN.md b/README-CN.md index 8233cfe87..9a6262e8d 100644 --- a/README-CN.md +++ b/README-CN.md @@ -67,7 +67,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.3.2 + appwrite/appwrite:1.3.3 ``` ### Windows @@ -79,7 +79,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.3.2 + appwrite/appwrite:1.3.3 ``` #### PowerShell @@ -89,7 +89,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.3.2 + appwrite/appwrite:1.3.3 ``` 运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。 diff --git a/README.md b/README.md index 7b05cac9b..5c98ed6c6 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ Table of Contents: - [CMD](#cmd) - [PowerShell](#powershell) - [Upgrade from an Older Version](#upgrade-from-an-older-version) +- [One-Click Setups](#one-click-setups) - [Getting Started](#getting-started) - [Services](#services) - [SDKs](#sdks) @@ -76,7 +77,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.3.2 + appwrite/appwrite:1.3.3 ``` ### Windows @@ -88,7 +89,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.3.2 + appwrite/appwrite:1.3.3 ``` #### PowerShell @@ -98,7 +99,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.3.2 + appwrite/appwrite:1.3.3 ``` 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. diff --git a/app/init.php b/app/init.php index a35da92d0..b5def038c 100644 --- a/app/init.php +++ b/app/init.php @@ -101,7 +101,7 @@ const APP_LIMIT_LIST_DEFAULT = 25; // Default maximum number of items to return const APP_KEY_ACCCESS = 24 * 60 * 60; // 24 hours const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours const APP_CACHE_BUSTER = 503; -const APP_VERSION_STABLE = '1.3.2'; +const APP_VERSION_STABLE = '1.3.3'; const APP_DATABASE_ATTRIBUTE_EMAIL = 'email'; const APP_DATABASE_ATTRIBUTE_ENUM = 'enum'; const APP_DATABASE_ATTRIBUTE_IP = 'ip'; diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 1017728ee..9ce1d262f 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -58,6 +58,7 @@ abstract class Migration '1.3.0' => 'V18', '1.3.1' => 'V18', '1.3.2' => 'V18', + '1.3.3' => 'V18', ]; /**