migrations/Version20230512095625.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 Version20230512095625 extends AbstractMigration
  11. {
  12.     public function getDescription(): string
  13.     {
  14.         return '';
  15.     }
  16.     public function up(Schema $schema): void
  17.     {
  18.         // this up() migration is auto-generated, please modify it to your needs
  19.         $this->addSql(
  20.             '
  21.                 CREATE TABLE oim_case_tasks (
  22.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
  23.                     oim_case_id INT NOT NULL COMMENT \'Internal ID\',
  24.                     oim_task_id INT NOT NULL COMMENT \'Internal ID\',
  25.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
  26.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
  27.                     description VARCHAR(225) NOT NULL COMMENT \'description of this task\',
  28.                     target_date DATETIME DEFAULT NULL COMMENT \'deadline of task\',
  29.                     status INT NOT NULL COMMENT \'status of current task\',
  30.                     INDEX IDX_3E1421A7F60F70BA (oim_case_id),
  31.                     INDEX IDX_3E1421A7B4A9A5C9 (oim_task_id),
  32.                     PRIMARY KEY(id)
  33.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  34.             '
  35.         );
  36.         $this->addSql(
  37.             '
  38.                 ALTER TABLE oim_case_tasks ADD CONSTRAINT FK_3E1421A7F60F70BA
  39.                     FOREIGN KEY (oim_case_id) REFERENCES oim_case (id) ON DELETE CASCADE;
  40.             '
  41.         );
  42.         $this->addSql(
  43.             '
  44.                 ALTER TABLE oim_case_tasks ADD CONSTRAINT FK_3E1421A7B4A9A5C9 FOREIGN KEY
  45.                     (oim_task_id) REFERENCES oim_task (id);
  46.             '
  47.         );
  48.     }
  49.     public function down(Schema $schema): void
  50.     {
  51.         // this down() migration is auto-generated, please modify it to your needs
  52.         $this->addSql('ALTER TABLE oim_case_tasks DROP FOREIGN KEY FK_3E1421A7F60F70BA');
  53.         $this->addSql('ALTER TABLE oim_case_tasks DROP FOREIGN KEY FK_3E1421A7B4A9A5C9');
  54.         $this->addSql('DROP TABLE oim_case_tasks');
  55.     }
  56. }