migrations/Version20260204120922.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 Version20260204120922 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 cmr_case (
  21.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\', 
  22.                     employee_id INT NOT NULL COMMENT \'Internal ID\', 
  23.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\', 
  24.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\', 
  25.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\', 
  26.                     rv_number VARCHAR(12) DEFAULT NULL COMMENT \'Employee\'\'s RV number\', 
  27.                     country_id VARCHAR(2) DEFAULT NULL COMMENT \'Country code in upper case (ISO 3166-1 Alpha-2)\', 
  28.                     civil_servant_or_student SMALLINT NOT NULL COMMENT \'Flag indicating whether the case is for a civil servant or student.\', 
  29.                     activity_code VARCHAR(225) NOT NULL COMMENT \'Activity code BfA\', 
  30.                     report_to_odin SMALLINT DEFAULT NULL COMMENT \'Flag indicating whether the case should be reported to Odin.\', 
  31.                     report_to_gvs SMALLINT DEFAULT NULL COMMENT \'Flag indicating whether the case should be reported to GVS.\', 
  32.                     address VARCHAR(225) NOT NULL COMMENT \'Address of the employee assigned to the CMR case\', 
  33.                     city VARCHAR(225) NOT NULL COMMENT \'City of the employee assigned to the CMR case\', 
  34.                     zip_code VARCHAR(16) NOT NULL COMMENT \'Zip code of the employee assigned to the CMR case\', 
  35.                     phone VARCHAR(225) DEFAULT NULL COMMENT \'Phone number\',
  36.                     created_by_id INT NOT NULL COMMENT \'Internal ID\',
  37.                     updated_by_id INT DEFAULT NULL COMMENT \'Internal ID\',
  38.                     UNIQUE INDEX UNIQ_74C2E7DC8C03F15C (employee_id), 
  39.                     UNIQUE INDEX UNIQ_74C2E7DCA0AC4043 (rv_number),
  40.                     INDEX IDX_74C2E7DCF92F3E70 (country_id),
  41.                     INDEX IDX_74C2E7DCDE12AB56 (created_by_id),
  42.                     INDEX IDX_74C2E7DC16FE72E1 (updated_by_id),
  43.                     PRIMARY KEY(id)
  44.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  45.             '
  46.         );
  47.         $this->addSql(
  48.             '
  49.                 ALTER TABLE cmr_case ADD CONSTRAINT FK_74C2E7DC8C03F15C FOREIGN KEY 
  50.                     (employee_id) REFERENCES employee (id)
  51.                 '
  52.         );
  53.         $this->addSql(
  54.             '
  55.                 ALTER TABLE cmr_case ADD CONSTRAINT FK_74C2E7DCF92F3E70 FOREIGN KEY 
  56.                     (country_id) REFERENCES country (id) ON DELETE SET NULL
  57.                 '
  58.         );
  59.         $this->addSql(
  60.             '
  61.                 ALTER TABLE cmr_case ADD CONSTRAINT FK_74C2E7DCDE12AB56 FOREIGN KEY 
  62.                     (created_by_id) REFERENCES user (id)
  63.              '
  64.         );
  65.         $this->addSql(
  66.             '
  67.                 ALTER TABLE cmr_case ADD CONSTRAINT FK_74C2E7DC16FE72E1 FOREIGN KEY 
  68.                     (updated_by_id) REFERENCES user (id)
  69.              '
  70.         );
  71.     }
  72.     public function down(Schema $schema): void
  73.     {
  74.         // this down() migration is auto-generated, please modify it to your needs
  75.         $this->addSql('ALTER TABLE cmr_case DROP FOREIGN KEY FK_74C2E7DC8C03F15C');
  76.         $this->addSql('ALTER TABLE cmr_case DROP FOREIGN KEY FK_74C2E7DCF92F3E70');
  77.         $this->addSql('ALTER TABLE cmr_case DROP FOREIGN KEY FK_74C2E7DCDE12AB56');
  78.         $this->addSql('DROP TABLE cmr_case');
  79.     }
  80. }