mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
fix: migration
This commit is contained in:
parent
f397f93975
commit
3e4e5a787d
1 changed files with 20 additions and 1 deletions
|
|
@ -175,6 +175,7 @@ class V11 extends Migration
|
||||||
'$collection!=' . OldDatabase::SYSTEM_COLLECTION_TASKS,
|
'$collection!=' . OldDatabase::SYSTEM_COLLECTION_TASKS,
|
||||||
'$collection!=' . OldDatabase::SYSTEM_COLLECTION_PROJECTS,
|
'$collection!=' . OldDatabase::SYSTEM_COLLECTION_PROJECTS,
|
||||||
'$collection!=' . OldDatabase::SYSTEM_COLLECTION_CONNECTIONS,
|
'$collection!=' . OldDatabase::SYSTEM_COLLECTION_CONNECTIONS,
|
||||||
|
'$collection!=' . OldDatabase::SYSTEM_COLLECTION_RESERVED,
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -421,7 +422,7 @@ class V11 extends Migration
|
||||||
* Check attributes and set their default values.
|
* Check attributes and set their default values.
|
||||||
*/
|
*/
|
||||||
if (array_key_exists($document->getCollection(), $this->oldCollections)) {
|
if (array_key_exists($document->getCollection(), $this->oldCollections)) {
|
||||||
foreach ($this->newCollections[$document->getCollection()]['attributes'] as $attr) {
|
foreach ($this->newCollections[$document->getCollection()]['attributes'] ?? [] as $attr) {
|
||||||
if (
|
if (
|
||||||
(!$attr['array'] ||
|
(!$attr['array'] ||
|
||||||
($attr['array'] && array_key_exists('filter', $attr)
|
($attr['array'] && array_key_exists('filter', $attr)
|
||||||
|
|
@ -436,7 +437,9 @@ class V11 extends Migration
|
||||||
switch ($document->getAttribute('$collection')) {
|
switch ($document->getAttribute('$collection')) {
|
||||||
case OldDatabase::SYSTEM_COLLECTION_PROJECTS:
|
case OldDatabase::SYSTEM_COLLECTION_PROJECTS:
|
||||||
$newProviders = [];
|
$newProviders = [];
|
||||||
|
$newAuths = [];
|
||||||
$providers = Config::getParam('providers', []);
|
$providers = Config::getParam('providers', []);
|
||||||
|
$auths = Config::getParam('auth', []);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add enabled OAuth2 providers to default data rules
|
* Add enabled OAuth2 providers to default data rules
|
||||||
|
|
@ -456,6 +459,22 @@ class V11 extends Migration
|
||||||
|
|
||||||
$document->setAttribute('providers', $newProviders);
|
$document->setAttribute('providers', $newProviders);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Migrate User providers settings
|
||||||
|
*/
|
||||||
|
foreach ($auths as $index => $auth) {
|
||||||
|
$enabled = $document->getAttribute('auth'.\ucfirst($auth['key']), true);
|
||||||
|
$newAuths['auth'.\ucfirst($auth['key'])] = $enabled;
|
||||||
|
$document->removeAttribute('auth'.\ucfirst($auth['key']));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($document->getAttribute('usersAuthLimit'))) {
|
||||||
|
$newAuths['limit'] = $document->getAttribute('usersAuthLimit');
|
||||||
|
$document->removeAttribute('usersAuthLimit');
|
||||||
|
}
|
||||||
|
|
||||||
|
$document->setAttribute('auths', $newProviders);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case OldDatabase::SYSTEM_COLLECTION_PLATFORMS:
|
case OldDatabase::SYSTEM_COLLECTION_PLATFORMS:
|
||||||
$projectId = $this->getProjectIdFromReadPermissions($document);
|
$projectId = $this->getProjectIdFromReadPermissions($document);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue