migrations/Version20220707194857.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 Version20220707194857 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Adjustment default columns to zero in notification_template';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $this->addSql("UPDATE notification_template SET setting = 0 WHERE setting IS NULL and profile_default IS NOT NULL;");
  18.         $this->addSql("UPDATE notification_template SET profile_default = 0 WHERE profile_default IS NULL AND setting IS NOT NULL;");
  19.         $this->addSql("UPDATE notification_template SET setting = 0, profile_default = 7 WHERE profile_default IS NULL AND setting IS NULL;");
  20.         $this->addSql('ALTER TABLE notification_template MODIFY COLUMN setting INT DEFAULT 0 NOT NULL;');
  21.         $this->addSql('ALTER TABLE notification_template MODIFY COLUMN profile_default INT DEFAULT 0 NOT NULL;');
  22.     }
  23. }