migrations/Version20260219072449.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 Version20260219072449 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_employment (
  21.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\', 
  22.                     case_entity_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.                     job_title VARCHAR(225) NOT NULL COMMENT \'Job title\', 
  27.                     start_date DATE NOT NULL COMMENT \'Start date\', 
  28.                     end_date DATE DEFAULT NULL COMMENT \'End date\', 
  29.                     notes TINYTEXT DEFAULT NULL COMMENT \'Notes\', 
  30.                     created_by_id INT NOT NULL COMMENT \'Internal ID\', 
  31.                     updated_by_id INT DEFAULT NULL COMMENT \'Internal ID\',
  32.                     INDEX IDX_176DAB72AF060DA6 (case_entity_id), 
  33.                     INDEX IDX_176DAB72DE12AB56 (created_by_id),
  34.                     INDEX IDX_176DAB7216FE72E1 (updated_by_id),
  35.                     PRIMARY KEY(id)
  36.                 ) 
  37.                 DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  38.             '
  39.         );
  40.         $this->addSql(
  41.             '
  42.                 ALTER TABLE cmr_employment ADD CONSTRAINT FK_176DAB72AF060DA6 FOREIGN KEY 
  43.                     (case_entity_id) REFERENCES cmr_case (id) ON DELETE CASCADE
  44.             '
  45.         );
  46.         $this->addSql(
  47.             '
  48.                 ALTER TABLE cmr_employment ADD CONSTRAINT FK_176DAB72DE12AB56 FOREIGN KEY 
  49.                     (created_by_id) REFERENCES user (id) ON DELETE CASCADE
  50.             '
  51.         );
  52.         $this->addSql(
  53.             '
  54.                 ALTER TABLE cmr_employment ADD CONSTRAINT FK_176DAB7216FE72E1 FOREIGN KEY 
  55.                     (updated_by_id) REFERENCES user (id) ON DELETE CASCADE
  56.             '
  57.         );
  58.     }
  59.     public function down(Schema $schema): void
  60.     {
  61.         // this down() migration is auto-generated, please modify it to your needs
  62.         $this->addSql('ALTER TABLE cmr_employment DROP FOREIGN KEY FK_176DAB72AF060DA6');
  63.         $this->addSql('DROP TABLE cmr_employment');
  64.     }
  65. }