<?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 Version20240702204702 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 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');
$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');
$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');
$this->addSql('ALTER TABLE toxicological_test_laboratory ADD CONSTRAINT FK_236EB40E8565851 FOREIGN KEY (establishment_id) REFERENCES establishment (id)');
$this->addSql('ALTER TABLE toxicological_test_result ADD CONSTRAINT FK_81342E7AD7374135 FOREIGN KEY (registration_student_pre_registration_id) REFERENCES registration_student_pre_registration (id)');
$this->addSql('ALTER TABLE toxicological_test_result ADD CONSTRAINT FK_81342E7A8565851 FOREIGN KEY (establishment_id) REFERENCES establishment (id)');
$this->addSql('ALTER TABLE toxicological_test_result ADD CONSTRAINT FK_81342E7AD2EECC3F FOREIGN KEY (school_year_id) REFERENCES school_year (id)');
$this->addSql('ALTER TABLE toxicological_test_result ADD CONSTRAINT FK_81342E7A467CCFFA FOREIGN KEY (toxicological_test_laboratory_id) REFERENCES toxicological_test_laboratory (id)');
$this->addSql('ALTER TABLE toxicological_test_result_line ADD CONSTRAINT FK_7E4400C81594D5AE FOREIGN KEY (toxicological_test_result_id) REFERENCES toxicological_test_result (id)');
$this->addSql('ALTER TABLE toxicological_test_result_line ADD CONSTRAINT FK_7E4400C88565851 FOREIGN KEY (establishment_id) REFERENCES establishment (id)');
$this->addSql('ALTER TABLE toxicological_test_result_line ADD CONSTRAINT FK_7E4400C8D2EECC3F FOREIGN KEY (school_year_id) REFERENCES school_year (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE toxicological_test_result DROP FOREIGN KEY FK_81342E7A467CCFFA');
$this->addSql('ALTER TABLE toxicological_test_result_line DROP FOREIGN KEY FK_7E4400C81594D5AE');
$this->addSql('DROP TABLE toxicological_test_laboratory');
$this->addSql('DROP TABLE toxicological_test_result');
$this->addSql('DROP TABLE toxicological_test_result_line');
}
}