<?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 Version20260114124207 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 (
id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
examination_id INT NOT NULL COMMENT \'Internal ID\',
org_unit_id INT NOT NULL COMMENT \'Internal ID\',
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\',
surveillance_type VARCHAR(30) NOT NULL COMMENT \'Examination\'\'s surveillance type\',
INDEX IDX_66144F64DAD0CFBF (examination_id),
INDEX IDX_66144F648BC224C3 (org_unit_id),
UNIQUE INDEX UNIQ_EXAMINATION_ORG_UNIT_SURVEILLANCE_TYPE (examination_id, org_unit_id, surveillance_type),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
'
);
$this->addSql(
'
ALTER TABLE medical_surveillance_case ADD CONSTRAINT FK_66144F64DAD0CFBF FOREIGN KEY
(examination_id) REFERENCES medical_surveillance_examination (id)
'
);
$this->addSql(
'
ALTER TABLE medical_surveillance_case ADD CONSTRAINT FK_66144F648BC224C3 FOREIGN KEY
(org_unit_id) REFERENCES org_unit (id)
'
);
}
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 DROP FOREIGN KEY FK_66144F64DAD0CFBF');
$this->addSql('ALTER TABLE medical_surveillance_case DROP FOREIGN KEY FK_66144F648BC224C3');
$this->addSql('DROP TABLE medical_surveillance_case');
}
}