1
0
Fork 0
mirror of synced 2024-06-03 11:24:48 +12:00

fix: migration

This commit is contained in:
Torsten Dittmann 2022-01-04 20:09:44 +01:00
parent 4160827f92
commit 762b532674

View file

@ -97,7 +97,8 @@ class V11 extends Migration
try {
Console::log('Created internal tables for : ' . $project->getAttribute('name') . ' (' . $project->getId() . ')');
$this->dbProject->createMetadata();
} catch (\Throwable $th) { }
} catch (\Throwable $th) {
}
/**
* Create Audit tables
@ -372,9 +373,10 @@ class V11 extends Migration
/**
* Convert numeric Attributes to float.
*/
if (is_numeric($attr)) {
if (!is_string($attr) && is_numeric($attr)) {
$document[$key] = floatval($attr);
}
if (\is_array($attr)) {
foreach ($attr as $index => $child) {
/**
@ -386,7 +388,7 @@ class V11 extends Migration
/**
* Convert array of numeric Attributes to array float.
*/
if (is_numeric($attr)) {
if (!is_string($child) && is_numeric($child)) {
$document[$key][$index] = floatval($child); // Convert any numeric to float
}
}
@ -451,16 +453,16 @@ class V11 extends Migration
* Add enabled OAuth2 providers to default data rules
*/
foreach ($providers as $index => $provider) {
$appId = $document->getAttribute('usersOauth2'.\ucfirst($index).'Appid');
$appSecret = $document->getAttribute('usersOauth2'.\ucfirst($index).'Secret');
$appId = $document->getAttribute('usersOauth2' . \ucfirst($index) . 'Appid');
$appSecret = $document->getAttribute('usersOauth2' . \ucfirst($index) . 'Secret');
if (!is_null($appId) || !is_null($appId)) {
$newProviders[$appId] = $appSecret;
}
$document
->removeAttribute('usersOauth2'.\ucfirst($index).'Appid')
->removeAttribute('usersOauth2'.\ucfirst($index).'Secret');
->removeAttribute('usersOauth2' . \ucfirst($index) . 'Appid')
->removeAttribute('usersOauth2' . \ucfirst($index) . 'Secret');
}
$document->setAttribute('providers', $newProviders);
@ -469,7 +471,7 @@ class V11 extends Migration
* Migrate User providers settings
*/
$oldAuths = [
'email-password'=> 'usersAuthEmailPassword',
'email-password' => 'usersAuthEmailPassword',
'magic-url' => 'usersAuthMagicURL',
'anonymous' => 'usersAuthAnonymous',
'invites' => 'usersAuthInvites',
@ -479,7 +481,7 @@ class V11 extends Migration
foreach ($oldAuths as $index => $auth) {
$enabled = $document->getAttribute($auth, true);
$newAuths['auth'.\ucfirst($auths[$index]['key'])] = $enabled;
$newAuths['auth' . \ucfirst($auths[$index]['key'])] = $enabled;
$document->removeAttribute($auth);
}
@ -638,7 +640,6 @@ class V11 extends Migration
$document->setAttribute('$write', str_replace('user:{self}', "user:{$document->getId()}", $write));
break;
case OldDatabase::SYSTEM_COLLECTION_TEAMS:
/**