migrations/Version20260312120000.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 Version20260312120000 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_activity (
  21.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\', 
  22.                     employment_id INT NOT NULL COMMENT \'Internal ID\', 
  23.                     work_activity_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.                     start_date DATE NOT NULL COMMENT \'Start date\', 
  28.                     end_date DATE DEFAULT NULL COMMENT \'End date\', 
  29.                     other_work_activity VARCHAR(255) DEFAULT NULL COMMENT \'Other work activity\', 
  30.                     notes TINYTEXT DEFAULT NULL COMMENT \'Notes\',
  31.                     created_by_id INT NOT NULL COMMENT \'Internal ID\',
  32.                     updated_by_id INT DEFAULT NULL COMMENT \'Internal ID\',
  33.                     INDEX IDX_E5D4AEFA9960E906 (employment_id), 
  34.                     INDEX IDX_E5D4AEFAFD7B4FB (work_activity_id), 
  35.                     INDEX IDX_2958AE99DE12AB56 (created_by_id), 
  36.                     INDEX IDX_2958AE9916FE72E1 (updated_by_id), 
  37.                     PRIMARY KEY(id)
  38.                 ) 
  39.                 DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  40.             '
  41.         );
  42.         $this->addSql(
  43.             '
  44.                 ALTER TABLE cmr_activity ADD CONSTRAINT FK_E5D4AEFA9960E906 FOREIGN KEY 
  45.                     (employment_id) REFERENCES cmr_employment (id) ON DELETE CASCADE
  46.             '
  47.         );
  48.         $this->addSql(
  49.             '
  50.                 ALTER TABLE cmr_activity ADD CONSTRAINT FK_E5D4AEFAFD7B4FB FOREIGN KEY 
  51.                     (work_activity_id) REFERENCES cmr_work_activity (id)
  52.             '
  53.         );
  54.         $this->addSql(
  55.             '
  56.                 ALTER TABLE cmr_activity ADD CONSTRAINT FK_2958AE99DE12AB56 FOREIGN KEY 
  57.                     (created_by_id) REFERENCES user (id)
  58.             '
  59.         );
  60.         $this->addSql(
  61.             '
  62.                 ALTER TABLE cmr_activity ADD CONSTRAINT FK_2958AE9916FE72E1 FOREIGN KEY 
  63.                     (updated_by_id) REFERENCES user (id)
  64.             '
  65.         );
  66.     }
  67.     public function down(Schema $schema): void
  68.     {
  69.         // this down() migration is auto-generated, please modify it to your needs
  70.         $this->addSql('ALTER TABLE cmr_activity DROP FOREIGN KEY FK_E5D4AEFA9960E906');
  71.         $this->addSql('ALTER TABLE cmr_activity DROP FOREIGN KEY FK_E5D4AEFAFD7B4FB');
  72.         $this->addSql('DROP TABLE cmr_activity');
  73.     }
  74. }