1
0
Fork 0
mirror of synced 2024-06-26 10:10:57 +12:00

fix(migration): major project iteration bug

This commit is contained in:
Torsten Dittmann 2021-01-14 15:03:34 +01:00
parent 28d4552ee2
commit a6a7f896c1
2 changed files with 12 additions and 9 deletions

View file

@ -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');

View file

@ -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]