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.
This commit is contained in:
parent
b2c8e182a5
commit
d0cfad9085
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue