fix migration for MySQL (#430)

This commit is contained in:
Kevin Papst
2018-11-19 15:24:00 +01:00
committed by GitHub
parent 40322c6de4
commit 67dc1c7640
5 changed files with 94 additions and 18 deletions

View File

@@ -247,7 +247,7 @@ class KimaiImporterCommand extends Command
$allImports += $counter;
$io->success('Imported users: ' . $counter);
} catch (\Exception $ex) {
$io->error('Failed to import users: ' . $ex->getMessage());
$io->error('Failed to import users: ' . $ex->getMessage() . PHP_EOL . $ex->getTraceAsString());
return;
}
@@ -257,7 +257,7 @@ class KimaiImporterCommand extends Command
$allImports += $counter;
$io->success('Imported customers: ' . $counter);
} catch (\Exception $ex) {
$io->error('Failed to import customers: ' . $ex->getMessage());
$io->error('Failed to import customers: ' . $ex->getMessage() . PHP_EOL . $ex->getTraceAsString());
return;
}
@@ -267,7 +267,7 @@ class KimaiImporterCommand extends Command
$allImports += $counter;
$io->success('Imported projects: ' . $counter);
} catch (\Exception $ex) {
$io->error('Failed to import projects: ' . $ex->getMessage());
$io->error('Failed to import projects: ' . $ex->getMessage() . PHP_EOL . $ex->getTraceAsString());
return;
}
@@ -277,7 +277,7 @@ class KimaiImporterCommand extends Command
$allImports += $counter;
$io->success('Imported activities: ' . $counter);
} catch (\Exception $ex) {
$io->error('Failed to import activities: ' . $ex->getMessage());
$io->error('Failed to import activities: ' . $ex->getMessage() . PHP_EOL . $ex->getTraceAsString());
return;
}
@@ -287,7 +287,7 @@ class KimaiImporterCommand extends Command
$allImports += $counter;
$io->success('Imported timesheet records: ' . $counter);
} catch (\Exception $ex) {
$io->error('Failed to import timesheet records: ' . $ex->getMessage());
$io->error('Failed to import timesheet records: ' . $ex->getMessage() . PHP_EOL . $ex->getTraceAsString());
return;
}
@@ -385,8 +385,10 @@ class KimaiImporterCommand extends Command
protected function bytesHumanReadable($size)
{
$unit = ['b', 'kB', 'MB', 'GB'];
$i = floor(log($size, 1024));
$a = (int) $i;
return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $unit[$i];
return @round($size / pow(1024, $i), 2) . ' ' . $unit[$a];
}
/**
@@ -422,12 +424,8 @@ class KimaiImporterCommand extends Command
if ($errors->count() > 0) {
/** @var \Symfony\Component\Validator\ConstraintViolation $error */
foreach ($errors as $error) {
$value = $error->getInvalidValue();
$io->error(
$error->getPropertyPath()
. ' (' . (is_array($value) ? implode(',', $value) : $value) . ')'
. "\n "
. $error->getMessage()
(string) $error
);
}
@@ -941,7 +939,7 @@ class KimaiImporterCommand extends Command
;
if (!$this->validateImport($io, $timesheet)) {
throw new \Exception('Failed to validate timesheet record: ' . $timesheet->getId());
throw new \Exception('Failed to validate timesheet record: ' . $oldRecord['timeEntryID']);
}
try {
@@ -952,8 +950,7 @@ class KimaiImporterCommand extends Command
}
++$counter;
} catch (\Exception $ex) {
$io->error('Failed to create timesheet record: ' . $timesheet->getId());
$io->error('Reason: ' . $ex->getMessage());
$io->error('Failed to create timesheet record: ' . $ex->getMessage());
}
$io->write('.');