migrations/Version20221026145258.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 Version20221026145258 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 mail_template (id INT AUTO_INCREMENT NOT NULL, brand_id INT NOT NULL, type VARCHAR(128) NOT NULL, is_active TINYINT(1) NOT NULL, active_from DATETIME DEFAULT NULL, active_to DATETIME DEFAULT NULL, is_deleted TINYINT(1) NOT NULL, INDEX IDX_4AB7DECB44F5D008 (brand_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE mail_template_translation (id INT AUTO_INCREMENT NOT NULL, mail_template_id INT NOT NULL, lang VARCHAR(4) NOT NULL, title VARCHAR(255) DEFAULT NULL, body LONGTEXT DEFAULT NULL, INDEX IDX_B15D51EBB1057265 (mail_template_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE mail_template ADD CONSTRAINT FK_4AB7DECB44F5D008 FOREIGN KEY (brand_id) REFERENCES brand (id)');
  21.         $this->addSql('ALTER TABLE mail_template_translation ADD CONSTRAINT FK_B15D51EBB1057265 FOREIGN KEY (mail_template_id) REFERENCES mail_template (id)');
  22.         $this->addSql('ALTER TABLE brand ADD is_wholesale TINYINT(1) DEFAULT NULL');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('ALTER TABLE mail_template_translation DROP FOREIGN KEY FK_B15D51EBB1057265');
  28.         $this->addSql('DROP TABLE mail_template');
  29.         $this->addSql('DROP TABLE mail_template_translation');
  30.         $this->addSql('ALTER TABLE brand DROP is_wholesale');
  31.     }
  32. }