migrations/Version20220821105451.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 Version20220821105451 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 material ADD name_trans JSON DEFAULT NULL, ADD description_trans JSON DEFAULT NULL, ADD short_description_trans JSON DEFAULT NULL');
  19.         $this->addSql('UPDATE material SET name_trans = \'[]\' WHERE name_trans IS NULL');
  20.         $this->addSql('UPDATE material SET description_trans = \'[]\' WHERE description_trans IS NULL');
  21.         $this->addSql('UPDATE material SET short_description_trans = \'[]\' WHERE short_description_trans IS NULL');
  22.         $this->addSql('ALTER TABLE material_variation ADD name_trans JSON DEFAULT NULL, ADD description_trans JSON DEFAULT NULL, ADD short_description_trans JSON DEFAULT NULL');
  23.         $this->addSql('UPDATE material_variation SET name_trans = \'[]\' WHERE name_trans IS NULL');
  24.         $this->addSql('UPDATE material_variation SET description_trans = \'[]\' WHERE description_trans IS NULL');
  25.         $this->addSql('UPDATE material_variation SET short_description_trans = \'[]\' WHERE short_description_trans IS NULL');
  26.         $this->addSql('ALTER TABLE packaging_type ADD name_trans JSON DEFAULT NULL, ADD description_trans JSON DEFAULT NULL, ADD short_description_trans JSON DEFAULT NULL');
  27.         $this->addSql('UPDATE packaging_type SET name_trans = \'[]\' WHERE name_trans IS NULL');
  28.         $this->addSql('UPDATE packaging_type SET description_trans = \'[]\' WHERE description_trans IS NULL');
  29.         $this->addSql('UPDATE packaging_type SET short_description_trans = \'[]\' WHERE short_description_trans IS NULL');
  30.         $this->addSql('ALTER TABLE pouch_option ADD name_trans JSON DEFAULT NULL, ADD description_trans JSON DEFAULT NULL, ADD short_description_trans JSON DEFAULT NULL, ADD is_visible_in_web_constructor TINYINT(1) NOT NULL');
  31.         $this->addSql('UPDATE pouch_option SET name_trans = \'[]\' WHERE name_trans IS NULL');
  32.         $this->addSql('UPDATE pouch_option SET description_trans = \'[]\' WHERE description_trans IS NULL');
  33.         $this->addSql('UPDATE pouch_option SET short_description_trans = \'[]\' WHERE short_description_trans IS NULL');
  34.     }
  35.     public function down(Schema $schema): void
  36.     {
  37.         // this down() migration is auto-generated, please modify it to your needs
  38.         $this->addSql('ALTER TABLE material DROP name_trans, DROP description_trans, DROP short_description_trans');
  39.         $this->addSql('ALTER TABLE material_variation DROP name_trans, DROP description_trans, DROP short_description_trans');
  40.         $this->addSql('ALTER TABLE packaging_type DROP name_trans, DROP description_trans, DROP short_description_trans');
  41.         $this->addSql('ALTER TABLE pouch_option DROP name_trans, DROP description_trans, DROP short_description_trans, DROP is_visible_in_web_constructor');
  42.     }
  43. }