<?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 Version20260115104009 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 medical_surveillance_case_employee (
id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
employee_id INT NOT NULL COMMENT \'Internal ID\',
case_entity_id INT NOT NULL COMMENT \'Internal ID\',
last_examination_date DATE DEFAULT NULL COMMENT \'Last examination date\',
next_examination_date DATE NOT NULL COMMENT \'Next examination date\',
appointment_date DATE DEFAULT NULL COMMENT \'Appointment date\',
start_date DATE DEFAULT NULL COMMENT \'Start date in the G-code\',
created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
last_active_date DATE DEFAULT NULL COMMENT \'Last active date\',
INDEX IDX_CF5164B28C03F15C (employee_id),
INDEX IDX_CF5164B2AF060DA6 (case_entity_id),
UNIQUE INDEX UNIQ_CASE_ENTITY_EMPLOYEE (employee_id, case_entity_id),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
'
);
$this->addSql(
'
ALTER TABLE medical_surveillance_case_employee ADD CONSTRAINT FK_CF5164B28C03F15C FOREIGN KEY
(employee_id) REFERENCES employee (id)
'
);
$this->addSql(
'
ALTER TABLE medical_surveillance_case_employee ADD CONSTRAINT FK_CF5164B2AF060DA6 FOREIGN KEY
(case_entity_id) REFERENCES medical_surveillance_case (id) ON DELETE CASCADE
'
);
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE medical_surveillance_case_employee DROP FOREIGN KEY FK_CF5164B28C03F15C');
$this->addSql('ALTER TABLE medical_surveillance_case_employee DROP FOREIGN KEY FK_CF5164B2AF060DA6');
$this->addSql('DROP TABLE medical_surveillance_case_employee');
}
}