migrations/Version20240830071552.php line 1

Open in your IDE?
  1. <?php
  2. /* @noinspection PhpUnused */
  3. declare(strict_types=1);
  4. namespace DoctrineMigrations;
  5. use Doctrine\DBAL\Schema\Schema;
  6. use Doctrine\Migrations\AbstractMigration;
  7. /**
  8.  * Auto-generated Migration: Please modify to your needs!
  9.  */
  10. final class Version20240830071552 extends AbstractMigration
  11. {
  12.     public function down(Schema $schema): void
  13.     {
  14.         // this down() migration is auto-generated, please modify it to your needs
  15.         $this->addSql('ALTER TABLE job_lab_case_matching_rejection DROP FOREIGN KEY FK_425EC554C0EF82D7');
  16.         $this->addSql('ALTER TABLE job_lab_case_matching_rejection DROP FOREIGN KEY FK_425EC5548BC224C3');
  17.         $this->addSql('ALTER TABLE job_lab_case_matching_rejection DROP FOREIGN KEY FK_425EC554AC25FB46');
  18.         $this->addSql('DROP TABLE job_lab_case_matching_rejection');
  19.     }
  20.     public function getDescription(): string
  21.     {
  22.         return
  23.             "- Introduces job lab case matching rejection table.";
  24.     }
  25.     public function up(Schema $schema): void
  26.     {
  27.         // this up() migration is auto-generated, please modify it to your needs
  28.         $this->addSql(
  29.             '
  30.                 CREATE TABLE job_lab_case_matching_rejection (
  31.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
  32.                     job_lab_case_id INT NOT NULL COMMENT \'Internal ID\',
  33.                     workplace_id INT NOT NULL COMMENT \'Internal ID\',
  34.                     org_unit_id INT NOT NULL COMMENT \'Internal ID\',
  35.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
  36.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
  37.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\',
  38.                     rejection_reason TEXT NOT NULL COMMENT \'Reason for rejection\',
  39.                     dirty SMALLINT NOT NULL COMMENT \'Dirty flag for the matching rejection\',
  40.                     INDEX IDX_425EC554C0EF82D7 (job_lab_case_id),
  41.                     INDEX IDX_425EC5548BC224C3 (org_unit_id),
  42.                     INDEX IDX_425EC554AC25FB46 (workplace_id),
  43.                     UNIQUE INDEX UNIQ_CASE_ENTITY_WORKPLACE_ORG_UNIT (job_lab_case_id, workplace_id, org_unit_id),
  44.                     PRIMARY KEY(id)
  45.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  46.             '
  47.         );
  48.         $this->addSql(
  49.             '
  50.                 ALTER TABLE job_lab_case_matching_rejection ADD CONSTRAINT FK_425EC554C0EF82D7
  51.                     FOREIGN KEY (job_lab_case_id) REFERENCES job_lab_case (id) ON DELETE CASCADE;
  52.             '
  53.         );
  54.         $this->addSql(
  55.             '
  56.                 ALTER TABLE job_lab_case_matching_rejection ADD CONSTRAINT FK_425EC5548BC224C3
  57.                     FOREIGN KEY (org_unit_id) REFERENCES org_unit (id) ON DELETE CASCADE;
  58.             '
  59.         );
  60.         $this->addSql(
  61.             '
  62.                 ALTER TABLE job_lab_case_matching_rejection ADD CONSTRAINT FK_425EC554AC25FB46
  63.                     FOREIGN KEY (workplace_id) REFERENCES workplace (id) ON DELETE CASCADE;
  64.             '
  65.         );
  66.     }
  67. }