migrations/Version20260114124207.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 Version20260114124207 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(
  19.             '
  20.                 CREATE TABLE medical_surveillance_case (
  21.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\', 
  22.                     examination_id INT NOT NULL COMMENT \'Internal ID\', 
  23.                     org_unit_id INT NOT NULL COMMENT \'Internal ID\', 
  24.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\', 
  25.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\', 
  26.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\', 
  27.                     surveillance_type VARCHAR(30) NOT NULL COMMENT \'Examination\'\'s surveillance type\', 
  28.                     INDEX IDX_66144F64DAD0CFBF (examination_id), 
  29.                     INDEX IDX_66144F648BC224C3 (org_unit_id), 
  30.                     UNIQUE INDEX UNIQ_EXAMINATION_ORG_UNIT_SURVEILLANCE_TYPE (examination_id, org_unit_id, surveillance_type), 
  31.                     PRIMARY KEY(id)
  32.                ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  33.            '
  34.         );
  35.         $this->addSql(
  36.             '
  37.                 ALTER TABLE medical_surveillance_case ADD CONSTRAINT FK_66144F64DAD0CFBF FOREIGN KEY 
  38.                     (examination_id) REFERENCES medical_surveillance_examination (id)
  39.             '
  40.         );
  41.         $this->addSql(
  42.             '
  43.                 ALTER TABLE medical_surveillance_case ADD CONSTRAINT FK_66144F648BC224C3 FOREIGN KEY 
  44.                     (org_unit_id) REFERENCES org_unit (id)
  45.             '
  46.         );
  47.     }
  48.     public function down(Schema $schema): void
  49.     {
  50.         // this down() migration is auto-generated, please modify it to your needs
  51.         $this->addSql('ALTER TABLE medical_surveillance_case DROP FOREIGN KEY FK_66144F64DAD0CFBF');
  52.         $this->addSql('ALTER TABLE medical_surveillance_case DROP FOREIGN KEY FK_66144F648BC224C3');
  53.         $this->addSql('DROP TABLE medical_surveillance_case');
  54.     }
  55. }