migrations/Version20241129085353.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 Version20241129085353 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $this->addSql("ALTER TABLE `dp_week_days` ADD `sort_order` INT NOT NULL AFTER `week_day_type`;"); 
  18.         $this->addSql("UPDATE `dp_week_days` SET `sort_order` = '1' WHERE `dp_week_days`.`week_day_type` = 'Sunday';"); 
  19.         $this->addSql("UPDATE `dp_week_days` SET `sort_order` = '2' WHERE `dp_week_days`.`week_day_type` = 'Monday';"); 
  20.         $this->addSql("UPDATE `dp_week_days` SET `sort_order` = '3' WHERE `dp_week_days`.`week_day_type` = 'Tuesday';"); 
  21.         $this->addSql("UPDATE `dp_week_days` SET `sort_order` = '4' WHERE `dp_week_days`.`week_day_type` = 'Wednesday';"); 
  22.         $this->addSql("UPDATE `dp_week_days` SET `sort_order` = '5' WHERE `dp_week_days`.`week_day_type` = 'Thursday';"); 
  23.         $this->addSql("UPDATE `dp_week_days` SET `sort_order` = '6' WHERE `dp_week_days`.`week_day_type` = 'Friday';"); 
  24.         $this->addSql("UPDATE `dp_week_days` SET `sort_order` = '7' WHERE `dp_week_days`.`week_day_type` = 'Saturday';"); 
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         $this->addSql("UPDATE `dp_week_days` SET `sort_order` = NULL WHERE `week_day_type` = 'Sunday';");
  29.         $this->addSql("UPDATE `dp_week_days` SET `sort_order` = NULL WHERE `week_day_type` = 'Monday';");
  30.         $this->addSql("UPDATE `dp_week_days` SET `sort_order` = NULL WHERE `week_day_type` = 'Tuesday';");
  31.         $this->addSql("UPDATE `dp_week_days` SET `sort_order` = NULL WHERE `week_day_type` = 'Wednesday';");
  32.         $this->addSql("UPDATE `dp_week_days` SET `sort_order` = NULL WHERE `week_day_type` = 'Thursday';");
  33.         $this->addSql("UPDATE `dp_week_days` SET `sort_order` = NULL WHERE `week_day_type` = 'Friday';");
  34.         $this->addSql("UPDATE `dp_week_days` SET `sort_order` = NULL WHERE `week_day_type` = 'Saturday';");
  35.         $this->addSql("ALTER TABLE `dp_week_days` DROP COLUMN `sort_order`;");        
  36.     }
  37. }