migrations/Version20240206071517.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 Version20240206071517 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('ALTER TABLE header_menu DROP FOREIGN KEY FK_D081401E95C43776');
  19.         $this->addSql('ALTER TABLE header_menu_translations DROP FOREIGN KEY FK_B10C0A22C2AC5D3');
  20.         $this->addSql('ALTER TABLE mail_template_translate DROP FOREIGN KEY FK_675E581E2C2AC5D3');
  21.         $this->addSql('ALTER TABLE static_pages DROP FOREIGN KEY FK_9BE40C2F727ACA70');
  22.         $this->addSql('ALTER TABLE static_pages DROP FOREIGN KEY FK_9BE40C2F73E8DD26');
  23.         $this->addSql('ALTER TABLE static_pages_translation DROP FOREIGN KEY FK_FCA250372C2AC5D3');
  24.         $this->addSql('DROP TABLE header_menu');
  25.         $this->addSql('DROP TABLE header_menu_translations');
  26.         $this->addSql('DROP TABLE mail_template_translate');
  27.         $this->addSql('DROP TABLE static_pages');
  28.         $this->addSql('DROP TABLE static_pages_translation');
  29.         $this->addSql('ALTER TABLE mail_template ADD subject VARCHAR(191) NOT NULL, ADD body LONGTEXT NOT NULL, ADD plain_body LONGTEXT NOT NULL');
  30.     }
  31.     public function down(Schema $schema): void
  32.     {
  33.         // this down() migration is auto-generated, please modify it to your needs
  34.         $this->addSql('CREATE TABLE header_menu (id INT AUTO_INCREMENT NOT NULL, static_page_id INT DEFAULT NULL, position INT UNSIGNED DEFAULT NULL, type SMALLINT NOT NULL, link VARCHAR(191) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, slug VARCHAR(191) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, active SMALLINT DEFAULT 0 NOT NULL, INDEX IDX_D081401E95C43776 (static_page_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  35.         $this->addSql('CREATE TABLE header_menu_translations (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, title VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, locale VARCHAR(10) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, UNIQUE INDEX header_menu_translations_unique_translation (translatable_id, locale), INDEX IDX_B10C0A22C2AC5D3 (translatable_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  36.         $this->addSql('CREATE TABLE mail_template_translate (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, subject VARCHAR(191) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, body LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, plain_body LONGTEXT CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, locale VARCHAR(5) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, UNIQUE INDEX mail_template_translate_unique_translation (translatable_id, locale), INDEX IDX_675E581E2C2AC5D3 (translatable_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  37.         $this->addSql('CREATE TABLE static_pages (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, meta_image_id INT DEFAULT NULL, lft INT NOT NULL, lvl INT NOT NULL, rgt INT NOT NULL, created_at DATETIME DEFAULT NULL, updated_at DATETIME DEFAULT NULL, active SMALLINT DEFAULT 0 NOT NULL, slug VARCHAR(191) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, title_for_slug VARCHAR(191) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, INDEX IDX_9BE40C2F73E8DD26 (meta_image_id), UNIQUE INDEX UNIQ_9BE40C2F989D9B62 (slug), INDEX IDX_9BE40C2F727ACA70 (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  38.         $this->addSql('CREATE TABLE static_pages_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, locale VARCHAR(10) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, title VARCHAR(191) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, content LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, meta_title VARCHAR(191) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, meta_keywords VARCHAR(191) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, meta_description LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, meta_canonical VARCHAR(191) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, UNIQUE INDEX static_pages_translation_unique_translation (translatable_id, locale), INDEX IDX_FCA250372C2AC5D3 (translatable_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
  39.         $this->addSql('ALTER TABLE header_menu ADD CONSTRAINT FK_D081401E95C43776 FOREIGN KEY (static_page_id) REFERENCES static_pages (id) ON UPDATE NO ACTION ON DELETE CASCADE');
  40.         $this->addSql('ALTER TABLE header_menu_translations ADD CONSTRAINT FK_B10C0A22C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES header_menu (id) ON UPDATE NO ACTION ON DELETE CASCADE');
  41.         $this->addSql('ALTER TABLE mail_template_translate ADD CONSTRAINT FK_675E581E2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES mail_template (id) ON UPDATE NO ACTION ON DELETE CASCADE');
  42.         $this->addSql('ALTER TABLE static_pages ADD CONSTRAINT FK_9BE40C2F727ACA70 FOREIGN KEY (parent_id) REFERENCES static_pages (id) ON UPDATE NO ACTION ON DELETE SET NULL');
  43.         $this->addSql('ALTER TABLE static_pages ADD CONSTRAINT FK_9BE40C2F73E8DD26 FOREIGN KEY (meta_image_id) REFERENCES media__media (id) ON UPDATE NO ACTION ON DELETE SET NULL');
  44.         $this->addSql('ALTER TABLE static_pages_translation ADD CONSTRAINT FK_FCA250372C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES static_pages (id) ON UPDATE NO ACTION ON DELETE CASCADE');
  45.         $this->addSql('ALTER TABLE mail_template DROP subject, DROP body, DROP plain_body');
  46.     }
  47. }