migrations/Version20220913142558.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 Version20220913142558 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('CREATE TABLE cal_faq_category (id INT AUTO_INCREMENT NOT NULL, title_id INT DEFAULT NULL, description_id INT DEFAULT NULL, position INT NOT NULL, UNIQUE INDEX UNIQ_E1E36D2A9F87BD (title_id), UNIQUE INDEX UNIQ_E1E36D2D9F966B (description_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE cal_faq_item (id INT AUTO_INCREMENT NOT NULL, title_id INT DEFAULT NULL, description_id INT DEFAULT NULL, category_id INT DEFAULT NULL, position INT NOT NULL, UNIQUE INDEX UNIQ_AC54C927A9F87BD (title_id), UNIQUE INDEX UNIQ_AC54C927D9F966B (description_id), INDEX IDX_AC54C92712469DE2 (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE cal_faq_category ADD CONSTRAINT FK_E1E36D2A9F87BD FOREIGN KEY (title_id) REFERENCES cal_translation (id)');
  21.         $this->addSql('ALTER TABLE cal_faq_category ADD CONSTRAINT FK_E1E36D2D9F966B FOREIGN KEY (description_id) REFERENCES cal_translation (id)');
  22.         $this->addSql('ALTER TABLE cal_faq_item ADD CONSTRAINT FK_AC54C927A9F87BD FOREIGN KEY (title_id) REFERENCES cal_translation (id)');
  23.         $this->addSql('ALTER TABLE cal_faq_item ADD CONSTRAINT FK_AC54C927D9F966B FOREIGN KEY (description_id) REFERENCES cal_translation (id)');
  24.         $this->addSql('ALTER TABLE cal_faq_item ADD CONSTRAINT FK_AC54C92712469DE2 FOREIGN KEY (category_id) REFERENCES cal_faq_category (id)');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         // this down() migration is auto-generated, please modify it to your needs
  29.         $this->addSql('ALTER TABLE cal_faq_category DROP FOREIGN KEY FK_E1E36D2A9F87BD');
  30.         $this->addSql('ALTER TABLE cal_faq_category DROP FOREIGN KEY FK_E1E36D2D9F966B');
  31.         $this->addSql('ALTER TABLE cal_faq_item DROP FOREIGN KEY FK_AC54C927A9F87BD');
  32.         $this->addSql('ALTER TABLE cal_faq_item DROP FOREIGN KEY FK_AC54C927D9F966B');
  33.         $this->addSql('ALTER TABLE cal_faq_item DROP FOREIGN KEY FK_AC54C92712469DE2');
  34.         $this->addSql('DROP TABLE cal_faq_category');
  35.         $this->addSql('DROP TABLE cal_faq_item');
  36.     }
  37. }