migrations/Version20240424083626.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 Version20240424083626 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 discount_translation (id INT AUTO_INCREMENT NOT NULL, discount_id INT DEFAULT NULL, locale VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, sticky VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL, INDEX IDX_F618B1574C7C611F (discount_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE discount_translation ADD CONSTRAINT FK_F618B1574C7C611F FOREIGN KEY (discount_id) REFERENCES discount (id)');
  20.         $this->addSql('ALTER TABLE discount ADD popup_seo_url_id INT DEFAULT NULL, ADD is_popup TINYINT(1) NOT NULL');
  21.         $this->addSql('ALTER TABLE discount ADD CONSTRAINT FK_E1E0B40E4002008B FOREIGN KEY (popup_seo_url_id) REFERENCES seo_page (id)');
  22.         $this->addSql('CREATE INDEX IDX_E1E0B40E4002008B ON discount (popup_seo_url_id)');
  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 discount_translation DROP FOREIGN KEY FK_F618B1574C7C611F');
  28.         $this->addSql('DROP TABLE discount_translation');
  29.         $this->addSql('ALTER TABLE discount DROP FOREIGN KEY FK_E1E0B40E4002008B');
  30.         $this->addSql('DROP INDEX IDX_E1E0B40E4002008B ON discount');
  31.         $this->addSql('ALTER TABLE discount DROP popup_seo_url_id, DROP is_popup');
  32.     }
  33. }