update composer packages (#3502)

drop full database schema in test
This commit is contained in:
Kevin Papst
2022-09-25 17:06:49 +02:00
committed by GitHub
parent bfab6f42d0
commit 96d0d4943b
4 changed files with 356 additions and 376 deletions

View File

@@ -73,31 +73,8 @@ EOT
}
if ($this->askConfirmation($input, $output, 'Do you want to drop and re-create the schema y/N ?')) {
try {
$command = $this->getApplication()->find('doctrine:schema:drop');
$command->run(new ArrayInput(['--force' => true]), $output);
} catch (Exception $ex) {
$io->error('Failed to drop database schema: ' . $ex->getMessage());
return 2;
}
try {
$command = $this->getApplication()->find('doctrine:query:sql');
$command->run(new ArrayInput(['sql' => 'DROP TABLE IF EXISTS migration_versions']), $output);
} catch (Exception $ex) {
$io->error('Failed to drop migration_versions table: ' . $ex->getMessage());
return 3;
}
try {
$command = $this->getApplication()->find('doctrine:query:sql');
$command->run(new ArrayInput(['sql' => 'DROP TABLE IF EXISTS kimai2_sessions']), $output);
} catch (Exception $ex) {
$io->error('Failed to drop kimai2_sessions table: ' . $ex->getMessage());
return 4;
if (($result = $this->dropSchema($io, $output)) !== 0) {
return $result;
}
try {
@@ -134,6 +111,38 @@ EOT
return 0;
}
protected function dropSchema(SymfonyStyle $io, OutputInterface $output): int
{
try {
$command = $this->getApplication()->find('doctrine:schema:drop');
$command->run(new ArrayInput(['--force' => true]), $output);
} catch (Exception $ex) {
$io->error('Failed to drop database schema: ' . $ex->getMessage());
return 2;
}
try {
$command = $this->getApplication()->find('doctrine:query:sql');
$command->run(new ArrayInput(['sql' => 'DROP TABLE IF EXISTS migration_versions']), $output);
} catch (Exception $ex) {
$io->error('Failed to drop migration_versions table: ' . $ex->getMessage());
return 3;
}
try {
$command = $this->getApplication()->find('doctrine:query:sql');
$command->run(new ArrayInput(['sql' => 'DROP TABLE IF EXISTS kimai2_sessions']), $output);
} catch (Exception $ex) {
$io->error('Failed to drop kimai2_sessions table: ' . $ex->getMessage());
return 4;
}
return 0;
}
private function askConfirmation(InputInterface $input, OutputInterface $output, string $question): bool
{
if (!$input->isInteractive()) {