migrations/Version20240605113549.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 Version20240605113549 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_work_attempt_unsuccessful_reason_l10n DROP FOREIGN KEY FK_58F39BF3706E52B3');
  16.         $this->addSql('ALTER TABLE job_lab_work_attempt_unsuccessful_reason_l10n DROP FOREIGN KEY FK_58F39BF382F1BAF4');
  17.         $this->addSql('DROP TABLE job_lab_work_attempt_unsuccessful_reason_l10n');
  18.         $this->addSql('DROP TABLE job_lab_work_attempt_unsuccessful_reason');
  19.     }
  20.     public function getDescription(): string
  21.     {
  22.         return
  23.             "- Introduces job_lab_work_attempt_unsuccessful_reason table and localizations.";
  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_work_attempt_unsuccessful_reason (
  31.                     id INT AUTO_INCREMENT NOT NULL COMMENT \'Internal ID\',
  32.                     created INT NOT NULL COMMENT \'Entity creation date as UNIX timestamp\',
  33.                     active SMALLINT DEFAULT 1 NOT NULL COMMENT \'Indicator if entity is active\',
  34.                     last_active_date DATE DEFAULT NULL COMMENT \'Last active date\',
  35.                     PRIMARY KEY(id)
  36.                  ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  37.             '
  38.         );
  39.         $this->addSql(
  40.             '
  41.                 CREATE TABLE job_lab_work_attempt_unsuccessful_reason_l10n (
  42.                     parent_entity_id INT NOT NULL COMMENT \'Internal ID\',
  43.                     language_id VARCHAR(2) NOT NULL COMMENT \'Language code in lower case (ISO 639-1)\',
  44.                     name VARCHAR(225) DEFAULT NULL
  45.                         COMMENT \'Work attempt unsuccessful reason name in referenced language\',
  46.                     INDEX IDX_B77FADB2706E52B3 (parent_entity_id),
  47.                     INDEX IDX_B77FADB282F1BAF4 (language_id),
  48.                     PRIMARY KEY(parent_entity_id, language_id)
  49.                   ) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB
  50.                   '
  51.         );
  52.         $this->addSql(
  53.             '
  54.                 ALTER TABLE job_lab_work_attempt_unsuccessful_reason_l10n ADD CONSTRAINT FK_58F39BF3706E52B3
  55.                     FOREIGN KEY (parent_entity_id) REFERENCES job_lab_work_attempt_unsuccessful_reason (id)
  56.                         ON DELETE CASCADE
  57.             '
  58.         );
  59.         $this->addSql(
  60.             '
  61.                 ALTER TABLE job_lab_work_attempt_unsuccessful_reason_l10n ADD CONSTRAINT FK_58F39BF382F1BAF4
  62.                     FOREIGN KEY (language_id) REFERENCES language (id) ON DELETE CASCADE
  63.             '
  64.         );
  65.     }
  66. }