<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220418234641 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE enquete (id INT AUTO_INCREMENT NOT NULL, created_id INT DEFAULT NULL, updated_id INT DEFAULT NULL, company_id INT NOT NULL, name VARCHAR(255) NOT NULL, presentation LONGTEXT DEFAULT NULL, from_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', end_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', status VARCHAR(20) NOT NULL, INDEX IDX_D6D86B295EE01E44 (created_id), INDEX IDX_D6D86B29960CC7F3 (updated_id), INDEX IDX_D6D86B29979B1AD6 (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE label (id INT AUTO_INCREMENT NOT NULL, createby_id INT NOT NULL, updatedby_id INT NOT NULL, name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', status VARCHAR(20) DEFAULT NULL, INDEX IDX_EA750E87663CD76 (createby_id), INDEX IDX_EA750E8A43E35E8 (updatedby_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE question (id INT AUTO_INCREMENT NOT NULL, enquete_id INT DEFAULT NULL, label_id INT DEFAULT NULL, createby_id INT NOT NULL, updateby_id INT NOT NULL, target_id INT NOT NULL, title VARCHAR(255) NOT NULL, multiple_choice TINYINT(1) NOT NULL, comment LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', ordre INT NOT NULL, status VARCHAR(20) NOT NULL, INDEX IDX_B6F7494E5FDC5003 (enquete_id), INDEX IDX_B6F7494E33B92F39 (label_id), INDEX IDX_B6F7494E7663CD76 (createby_id), INDEX IDX_B6F7494E23AE0780 (updateby_id), INDEX IDX_B6F7494E158E0B66 (target_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE response (id INT AUTO_INCREMENT NOT NULL, question_id INT NOT NULL, createdby_id INT NOT NULL, updatedby_id INT NOT NULL, title VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', comment LONGTEXT DEFAULT NULL, status VARCHAR(20) NOT NULL, INDEX IDX_3E7B0BFB1E27F6BF (question_id), INDEX IDX_3E7B0BFBF0B5AF0B (createdby_id), INDEX IDX_3E7B0BFBA43E35E8 (updatedby_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE target (id INT AUTO_INCREMENT NOT NULL, createdby_id INT NOT NULL, updatedby_id INT NOT NULL, name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', status VARCHAR(20) NOT NULL, INDEX IDX_466F2FFCF0B5AF0B (createdby_id), INDEX IDX_466F2FFCA43E35E8 (updatedby_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE travel (id INT AUTO_INCREMENT NOT NULL, addby_id INT DEFAULT NULL, updateby_id INT DEFAULT NULL, code VARCHAR(255) NOT NULL, departure_date DATE NOT NULL, arrival_date DATE NOT NULL, status VARCHAR(50) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', type_travel VARCHAR(100) NOT NULL, image VARCHAR(255) DEFAULT NULL, INDEX IDX_53AEC095F93A8DEF (addby_id), INDEX IDX_53AEC09523AE0780 (updateby_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE enquete ADD CONSTRAINT FK_D6D86B295EE01E44 FOREIGN KEY (created_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE enquete ADD CONSTRAINT FK_D6D86B29960CC7F3 FOREIGN KEY (updated_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE enquete ADD CONSTRAINT FK_D6D86B29979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
$this->addSql('ALTER TABLE label ADD CONSTRAINT FK_EA750E87663CD76 FOREIGN KEY (createby_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE label ADD CONSTRAINT FK_EA750E8A43E35E8 FOREIGN KEY (updatedby_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE question ADD CONSTRAINT FK_B6F7494E5FDC5003 FOREIGN KEY (enquete_id) REFERENCES enquete (id)');
$this->addSql('ALTER TABLE question ADD CONSTRAINT FK_B6F7494E33B92F39 FOREIGN KEY (label_id) REFERENCES label (id)');
$this->addSql('ALTER TABLE question ADD CONSTRAINT FK_B6F7494E7663CD76 FOREIGN KEY (createby_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE question ADD CONSTRAINT FK_B6F7494E23AE0780 FOREIGN KEY (updateby_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE question ADD CONSTRAINT FK_B6F7494E158E0B66 FOREIGN KEY (target_id) REFERENCES target (id)');
$this->addSql('ALTER TABLE response ADD CONSTRAINT FK_3E7B0BFB1E27F6BF FOREIGN KEY (question_id) REFERENCES question (id)');
$this->addSql('ALTER TABLE response ADD CONSTRAINT FK_3E7B0BFBF0B5AF0B FOREIGN KEY (createdby_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE response ADD CONSTRAINT FK_3E7B0BFBA43E35E8 FOREIGN KEY (updatedby_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE target ADD CONSTRAINT FK_466F2FFCF0B5AF0B FOREIGN KEY (createdby_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE target ADD CONSTRAINT FK_466F2FFCA43E35E8 FOREIGN KEY (updatedby_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE travel ADD CONSTRAINT FK_53AEC095F93A8DEF FOREIGN KEY (addby_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE travel ADD CONSTRAINT FK_53AEC09523AE0780 FOREIGN KEY (updateby_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE question DROP FOREIGN KEY FK_B6F7494E5FDC5003');
$this->addSql('ALTER TABLE question DROP FOREIGN KEY FK_B6F7494E33B92F39');
$this->addSql('ALTER TABLE response DROP FOREIGN KEY FK_3E7B0BFB1E27F6BF');
$this->addSql('ALTER TABLE userresponse DROP FOREIGN KEY FK_123EF48CFBF32840');
$this->addSql('ALTER TABLE question DROP FOREIGN KEY FK_B6F7494E158E0B66');
$this->addSql('DROP TABLE enquete');
$this->addSql('DROP TABLE label');
$this->addSql('DROP TABLE question');
$this->addSql('DROP TABLE response');
$this->addSql('DROP TABLE target');
$this->addSql('DROP TABLE travel');
$this->addSql('ALTER TABLE user CHANGE roles roles LONGTEXT NOT NULL COLLATE `utf8mb4_bin`');
}
}