migrations/Version20260115104009.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 Version20260115104009 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_employee (
  21.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\', 
  22.                     employee_id INT NOT NULL COMMENT \'Internal ID\', 
  23.                     case_entity_id INT NOT NULL COMMENT \'Internal ID\', 
  24.                     last_examination_date DATE DEFAULT NULL COMMENT \'Last examination date\',
  25.                     next_examination_date DATE NOT NULL COMMENT \'Next examination date\', 
  26.                     appointment_date DATE DEFAULT NULL COMMENT \'Appointment date\',
  27.                     start_date DATE DEFAULT NULL COMMENT \'Start date in the G-code\',
  28.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\', 
  29.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\', 
  30.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\', 
  31.                     INDEX IDX_CF5164B28C03F15C (employee_id), 
  32.                     INDEX IDX_CF5164B2AF060DA6 (case_entity_id), 
  33.                     UNIQUE INDEX UNIQ_CASE_ENTITY_EMPLOYEE (employee_id, case_entity_id), 
  34.                     PRIMARY KEY(id)
  35.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  36.             '
  37.         );
  38.         $this->addSql(
  39.             '
  40.                 ALTER TABLE medical_surveillance_case_employee ADD CONSTRAINT FK_CF5164B28C03F15C FOREIGN KEY 
  41.                     (employee_id) REFERENCES employee (id)
  42.             '
  43.         );
  44.         $this->addSql(
  45.             '
  46.                 ALTER TABLE medical_surveillance_case_employee ADD CONSTRAINT FK_CF5164B2AF060DA6 FOREIGN KEY 
  47.                     (case_entity_id) REFERENCES medical_surveillance_case (id) ON DELETE CASCADE
  48.             '
  49.         );
  50.     }
  51.     public function down(Schema $schema): void
  52.     {
  53.         // this down() migration is auto-generated, please modify it to your needs
  54.         $this->addSql('ALTER TABLE medical_surveillance_case_employee DROP FOREIGN KEY FK_CF5164B28C03F15C');
  55.         $this->addSql('ALTER TABLE medical_surveillance_case_employee DROP FOREIGN KEY FK_CF5164B2AF060DA6');
  56.         $this->addSql('DROP TABLE medical_surveillance_case_employee');
  57.     }
  58. }