migrations/Version20250714113731.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 Version20250714113731 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_type (
  21.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\', 
  22.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\', 
  23.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\', 
  24.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\', 
  25.                     PRIMARY KEY(id)
  26.                 ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  27.             '
  28.         );
  29.         $this->addSql(
  30.             '
  31.                 CREATE TABLE sob_event_type_l10n (
  32.                     parent_entity_id INT NOT NULL COMMENT \'Internal ID\', 
  33.                     language_id VARCHAR(2) NOT NULL COMMENT \'Language code in lower case (ISO 639-1)\', 
  34.                     name VARCHAR(225) DEFAULT NULL COMMENT \'Event type name in referenced language\', 
  35.                     INDEX IDX_77567021706E52B3 (parent_entity_id), 
  36.                     INDEX IDX_7756702182F1BAF4 (language_id), 
  37.                     PRIMARY KEY(parent_entity_id, language_id)
  38.                  ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  39.              '
  40.         );
  41.         $this->addSql(
  42.             '
  43.                 ALTER TABLE sob_event_type_l10n ADD CONSTRAINT FK_77567021706E52B3 
  44.                     FOREIGN KEY (parent_entity_id) REFERENCES sob_event_type (id) ON DELETE CASCADE
  45.                 '
  46.         );
  47.         $this->addSql(
  48.             '
  49.                 ALTER TABLE sob_event_type_l10n ADD CONSTRAINT FK_7756702182F1BAF4 
  50.                     FOREIGN KEY (language_id) REFERENCES language (id) ON DELETE CASCADE
  51.                 '
  52.         );
  53.     }
  54.     public function down(Schema $schema): void
  55.     {
  56.         // this down() migration is auto-generated, please modify it to your needs
  57.         $this->addSql('ALTER TABLE sob_event_type_l10n DROP FOREIGN KEY FK_77567021706E52B3');
  58.         $this->addSql('ALTER TABLE sob_event_type_l10n DROP FOREIGN KEY FK_7756702182F1BAF4');
  59.         $this->addSql('DROP TABLE sob_event_type');
  60.         $this->addSql('DROP TABLE sob_event_type_l10n');
  61.     }
  62. }