647
composer.lock
generated
647
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -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()) {
|
||||
|
||||
@@ -16,8 +16,11 @@ use App\Entity\Team;
|
||||
use App\Entity\User;
|
||||
use App\Entity\UserPreference;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Exception;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
/**
|
||||
* Command used to execute all the basic application bootstrapping AFTER "composer install" was executed.
|
||||
@@ -143,4 +146,18 @@ class ResetTestCommand extends AbstractResetCommand
|
||||
|
||||
$this->entityManager->flush();
|
||||
}
|
||||
|
||||
protected function dropSchema(SymfonyStyle $io, OutputInterface $output): int
|
||||
{
|
||||
try {
|
||||
$command = $this->getApplication()->find('doctrine:schema:drop');
|
||||
$command->run(new ArrayInput(['--force' => true, '--full-database' => true]), $output);
|
||||
} catch (Exception $ex) {
|
||||
$io->error('Failed to drop database schema: ' . $ex->getMessage());
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,12 +14,13 @@ namespace DoctrineMigrations;
|
||||
use App\Doctrine\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
/**
|
||||
* Initial database structure of Kimai 2.
|
||||
* This file is mainly required for testing the migrations.
|
||||
*/
|
||||
final class Version20180701120000 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Initial database structure';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('CREATE TABLE kimai2_users (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(60) NOT NULL, mail VARCHAR(160) NOT NULL, password VARCHAR(254) DEFAULT NULL, alias VARCHAR(60) DEFAULT NULL, active TINYINT(1) NOT NULL, registration_date DATETIME DEFAULT NULL, title VARCHAR(50) DEFAULT NULL, avatar VARCHAR(255) DEFAULT NULL, roles LONGTEXT NOT NULL COMMENT \'(DC2Type:array)\', UNIQUE INDEX UNIQ_B9AC5BCE5E237E06 (name), UNIQUE INDEX UNIQ_B9AC5BCE5126AC48 (mail), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
|
||||
|
||||
Reference in New Issue
Block a user