migrations/Version20250520102851.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 Version20250520102851 extends AbstractMigration
  10. {
  11.     public function down(Schema $schema): void
  12.     {
  13.         $this->addSql('ALTER TABLE sob_task DROP FOREIGN KEY FK_B6468764C54C8C93');
  14.         $this->addSql('ALTER TABLE sob_task DROP FOREIGN KEY FK_B6468764AF060DA6');
  15.         $this->addSql('ALTER TABLE sob_task DROP FOREIGN KEY FK_B64687647D182D95');
  16.         $this->addSql('DROP TABLE sob_task');
  17.     }
  18.     public function getDescription(): string
  19.     {
  20.         return '';
  21.     }
  22.     // this down() migration is auto-generated, please modify it to your needs
  23.     public function up(Schema $schema): void
  24.     {
  25.         // this up() migration is auto-generated, please modify it to your needs
  26.         $this->addSql(
  27.             '
  28.                 CREATE TABLE sob_task (
  29.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\', 
  30.                     type_id INT DEFAULT NULL COMMENT \'Internal ID\', 
  31.                     case_entity_id INT NOT NULL COMMENT \'Internal ID\', 
  32.                     created_by_user_id INT DEFAULT NULL COMMENT \'Internal ID\', 
  33.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\', 
  34.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\', 
  35.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\', 
  36.                     due_date DATE DEFAULT NULL COMMENT \'Due date\', 
  37.                     notes TINYTEXT DEFAULT NULL COMMENT \'Notes\', 
  38.                     INDEX IDX_B6468764C54C8C93 (type_id), 
  39.                     INDEX IDX_B6468764AF060DA6 (case_entity_id), 
  40.                     INDEX IDX_B64687647D182D95 (created_by_user_id), 
  41.                     PRIMARY KEY(id)
  42.                   ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  43.               '
  44.         );
  45.         $this->addSql(
  46.             '
  47.                 ALTER TABLE sob_task ADD CONSTRAINT FK_B6468764C54C8C93
  48.                     FOREIGN KEY (type_id) REFERENCES sob_task_type (id)
  49.             '
  50.         );
  51.         $this->addSql(
  52.             '
  53.                 ALTER TABLE sob_task ADD CONSTRAINT FK_B6468764AF060DA6
  54.                     FOREIGN KEY (case_entity_id) REFERENCES sob_case (id) ON DELETE CASCADE
  55.             '
  56.         );
  57.         $this->addSql(
  58.             '
  59.                 ALTER TABLE sob_task ADD CONSTRAINT FK_B64687647D182D95
  60.                     FOREIGN KEY (created_by_user_id) REFERENCES user (id)
  61.             '
  62.         );
  63.     }
  64. }