migrations/Version20250716084407.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 Version20250716084407 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 sob_event (
  21.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\', 
  22.                     type_id INT DEFAULT NULL COMMENT \'Internal ID\', 
  23.                     case_entity_id INT NOT NULL COMMENT \'Internal ID\', 
  24.                     created_by INT DEFAULT 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.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\', 
  28.                     event_date DATE DEFAULT NULL COMMENT \'Event date\', 
  29.                     notes TEXT DEFAULT NULL COMMENT \'Notes\',
  30.                     updated_by INT DEFAULT NULL COMMENT \'Internal ID\',
  31.                     updated INT DEFAULT NULL COMMENT \'Entity update date as UNIX timestamp\',
  32.                     INDEX IDX_3A9143FDC54C8C93 (type_id), 
  33.                     INDEX IDX_3A9143FDAF060DA6 (case_entity_id), 
  34.                     INDEX IDX_3A9143FDDE12AB56 (created_by),
  35.                     INDEX IDX_3A9143FD16FE72E1 (updated_by),
  36.                     PRIMARY KEY(id)
  37.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  38.             '
  39.         );
  40.         $this->addSql(
  41.             '
  42.                 ALTER TABLE sob_event ADD CONSTRAINT FK_3A9143FDC54C8C93 
  43.                     FOREIGN KEY (type_id) REFERENCES sob_event_type (id)
  44.             '
  45.         );
  46.         $this->addSql(
  47.             '
  48.                 ALTER TABLE sob_event ADD CONSTRAINT FK_3A9143FDAF060DA6 
  49.                     FOREIGN KEY (case_entity_id) REFERENCES sob_case (id) ON DELETE CASCADE
  50.             '
  51.         );
  52.         $this->addSql(
  53.             '
  54.                 ALTER TABLE sob_event ADD CONSTRAINT FK_3A9143FDDE12AB56 
  55.                     FOREIGN KEY (created_by) REFERENCES user (id)
  56.             '
  57.         );
  58.         $this->addSql(
  59.             '
  60.                 ALTER TABLE sob_event ADD CONSTRAINT FK_3A9143FD16FE72E1 
  61.                     FOREIGN KEY (updated_by) REFERENCES user (id)
  62.             '
  63.         );
  64.     }
  65.     public function down(Schema $schema): void
  66.     {
  67.         // this down() migration is auto-generated, please modify it to your needs
  68.         $this->addSql('ALTER TABLE sob_event DROP FOREIGN KEY FK_3A9143FDC54C8C93');
  69.         $this->addSql('ALTER TABLE sob_event DROP FOREIGN KEY FK_3A9143FDAF060DA6');
  70.         $this->addSql('ALTER TABLE sob_event DROP FOREIGN KEY FK_3A9143FDDE12AB56');
  71.         $this->addSql('ALTER TABLE sob_event DROP FOREIGN KEY FK_3A9143FD16FE72E1');
  72.         $this->addSql('DROP TABLE sob_event');
  73.     }
  74. }