fix(migration): major project iteration bug
This commit is contained in:
parent
28d4552ee2
commit
a6a7f896c1
|
@ -38,7 +38,7 @@ $cli
|
|||
|
||||
$migration = new Version\V06($register->get('db')); //TODO: remove hardcoded version and move to dynamic migration
|
||||
|
||||
while ($sum >= 30) {
|
||||
while ($sum > 0) {
|
||||
foreach ($projects as $project) {
|
||||
try {
|
||||
$migration
|
||||
|
@ -61,8 +61,10 @@ $cli
|
|||
$sum = \count($projects);
|
||||
$offset = $offset + $limit;
|
||||
$count = $count + $sum;
|
||||
|
||||
Console::log('Fetched ' . $count . '/' . $consoleDB->getSum() . ' projects...');
|
||||
|
||||
if ($sum > 0) {
|
||||
Console::log('Fetched ' . $count . '/' . $consoleDB->getSum() . ' projects...');
|
||||
}
|
||||
}
|
||||
|
||||
Console::success('Data Migration Completed');
|
||||
|
|
|
@ -12,15 +12,14 @@ class V06 extends Migration
|
|||
{
|
||||
public function execute(): void
|
||||
{
|
||||
Console::log('I got nothing to do. Yet.');
|
||||
$project = $this->project;
|
||||
Console::log('Migrating project: ' . $project->getAttribute('name') . ' (' . $project->getId() . ')');
|
||||
|
||||
$this->forEachDocument([$this, 'fixDocument']);
|
||||
}
|
||||
|
||||
protected function fixDocument(Document $document)
|
||||
{
|
||||
$providers = Config::getParam('providers');
|
||||
|
||||
switch ($document->getAttribute('$collection')) {
|
||||
case Database::SYSTEM_COLLECTION_USERS:
|
||||
if ($document->getAttribute('password-update', null)) {
|
||||
|
@ -28,21 +27,23 @@ class V06 extends Migration
|
|||
->setAttribute('passwordUpdate', $document->getAttribute('password-update', $document->getAttribute('passwordUpdate', '')))
|
||||
->removeAttribute('password-update');
|
||||
}
|
||||
if($document->getAttribute('prefs', null)) {
|
||||
if ($document->getAttribute('prefs', null)) {
|
||||
//TODO: take care of filter ['json']
|
||||
}
|
||||
break;
|
||||
case Database::SYSTEM_COLLECTION_WEBHOOKS:
|
||||
if($document->getAttribute('httpPass', null)) {
|
||||
if ($document->getAttribute('httpPass', null)) {
|
||||
//TODO: take care of filter ['encrypt']
|
||||
}
|
||||
break;
|
||||
case Database::SYSTEM_COLLECTION_TASKS:
|
||||
if($document->getAttribute('httpPass', null)) {
|
||||
if ($document->getAttribute('httpPass', null)) {
|
||||
//TODO: take care of filter ['encrypt']
|
||||
}
|
||||
break;
|
||||
case Database::SYSTEM_COLLECTION_PROJECTS:
|
||||
$providers = Config::getParam('providers');
|
||||
|
||||
foreach ($providers as $key => $provider) {
|
||||
if ($document->getAttribute('usersOauth' . \ucfirst($key) . 'Secret', null)) {
|
||||
//TODO: take care of filter ['encrypt]
|
||||
|
|
Loading…
Reference in a new issue