migrations/Version20240702204702.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20240702204702 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('CREATE TABLE toxicological_test_laboratory (id INT AUTO_INCREMENT NOT NULL, establishment_id INT NOT NULL, name VARCHAR(255) NOT NULL, phone VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, image VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, INDEX IDX_236EB40E8565851 (establishment_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE toxicological_test_result (id INT AUTO_INCREMENT NOT NULL, registration_student_pre_registration_id INT NOT NULL, establishment_id INT NOT NULL, school_year_id INT NOT NULL, toxicological_test_laboratory_id INT NOT NULL, code VARCHAR(60) NOT NULL, name_of_supervisor VARCHAR(128) NOT NULL, create_date DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', direct_debit_date DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', laboratory_name VARCHAR(255) DEFAULT NULL, document_title VARCHAR(255) DEFAULT NULL, document_description LONGTEXT DEFAULT NULL, result VARCHAR(60) NOT NULL, conclusion LONGTEXT DEFAULT NULL, image VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, INDEX IDX_81342E7AD7374135 (registration_student_pre_registration_id), INDEX IDX_81342E7A8565851 (establishment_id), INDEX IDX_81342E7AD2EECC3F (school_year_id), INDEX IDX_81342E7A467CCFFA (toxicological_test_laboratory_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE toxicological_test_result_line (id INT AUTO_INCREMENT NOT NULL, toxicological_test_result_id INT NOT NULL, establishment_id INT NOT NULL, school_year_id INT NOT NULL, substance VARCHAR(128) NOT NULL, result VARCHAR(128) NOT NULL, detection_limit_temp VARCHAR(128) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, INDEX IDX_7E4400C81594D5AE (toxicological_test_result_id), INDEX IDX_7E4400C88565851 (establishment_id), INDEX IDX_7E4400C8D2EECC3F (school_year_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('ALTER TABLE toxicological_test_laboratory ADD CONSTRAINT FK_236EB40E8565851 FOREIGN KEY (establishment_id) REFERENCES establishment (id)');
  22.         $this->addSql('ALTER TABLE toxicological_test_result ADD CONSTRAINT FK_81342E7AD7374135 FOREIGN KEY (registration_student_pre_registration_id) REFERENCES registration_student_pre_registration (id)');
  23.         $this->addSql('ALTER TABLE toxicological_test_result ADD CONSTRAINT FK_81342E7A8565851 FOREIGN KEY (establishment_id) REFERENCES establishment (id)');
  24.         $this->addSql('ALTER TABLE toxicological_test_result ADD CONSTRAINT FK_81342E7AD2EECC3F FOREIGN KEY (school_year_id) REFERENCES school_year (id)');
  25.         $this->addSql('ALTER TABLE toxicological_test_result ADD CONSTRAINT FK_81342E7A467CCFFA FOREIGN KEY (toxicological_test_laboratory_id) REFERENCES toxicological_test_laboratory (id)');
  26.         $this->addSql('ALTER TABLE toxicological_test_result_line ADD CONSTRAINT FK_7E4400C81594D5AE FOREIGN KEY (toxicological_test_result_id) REFERENCES toxicological_test_result (id)');
  27.         $this->addSql('ALTER TABLE toxicological_test_result_line ADD CONSTRAINT FK_7E4400C88565851 FOREIGN KEY (establishment_id) REFERENCES establishment (id)');
  28.         $this->addSql('ALTER TABLE toxicological_test_result_line ADD CONSTRAINT FK_7E4400C8D2EECC3F FOREIGN KEY (school_year_id) REFERENCES school_year (id)');
  29.     }
  30.     public function down(Schema $schema): void
  31.     {
  32.         // this down() migration is auto-generated, please modify it to your needs
  33.         $this->addSql('ALTER TABLE toxicological_test_result DROP FOREIGN KEY FK_81342E7A467CCFFA');
  34.         $this->addSql('ALTER TABLE toxicological_test_result_line DROP FOREIGN KEY FK_7E4400C81594D5AE');
  35.         $this->addSql('DROP TABLE toxicological_test_laboratory');
  36.         $this->addSql('DROP TABLE toxicological_test_result');
  37.         $this->addSql('DROP TABLE toxicological_test_result_line');
  38.     }
  39. }