migrations/Version20220207082803.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 Version20220207082803 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("                      
  19.                         INSERT INTO subscription_settings(user_id, event_id, own, _all, selected, no)
  20.                             SELECT user.id, e.id, false, false, false, true                            
  21.                             FROM user
  22.                             INNER JOIN event AS e
  23.                                 ON e.code = 'sample.transition.to_producing'                                  
  24.                                 WHERE user.manufacturer_id is null
  25.                                 AND user.customer_id is null
  26.                                 AND user.is_active = 1
  27.                                     ");
  28.         $this->addSql("                      
  29.                         INSERT INTO subscription_settings(user_id, event_id, own, _all, selected, no)
  30.                             SELECT user.id, e.id, false, false, false, true                            
  31.                             FROM user
  32.                             INNER JOIN event AS e
  33.                                 ON e.code = 'sample.transition.to_transit_to_office'                                  
  34.                                 WHERE user.manufacturer_id is null
  35.                                 AND user.customer_id is null
  36.                                 AND user.is_active = 1
  37.                                     ");
  38.         $this->addSql("                      
  39.                         INSERT INTO subscription_settings(user_id, event_id, own, _all, selected, no)
  40.                             SELECT user.id, e.id, false, false, false, true                            
  41.                             FROM user
  42.                             INNER JOIN event AS e
  43.                                 ON e.code = 'sample.transition.to_office'                                  
  44.                                 WHERE user.manufacturer_id is null
  45.                                 AND user.customer_id is null
  46.                                 AND user.is_active = 1
  47.                                     ");
  48.         $this->addSql("                      
  49.                         INSERT INTO subscription_settings(user_id, event_id, own, _all, selected, no)
  50.                             SELECT user.id, e.id, false, false, false, true                            
  51.                             FROM user
  52.                             INNER JOIN event AS e
  53.                                 ON e.code = 'sample.transition.to_transit_to_customer'                                  
  54.                                 WHERE user.manufacturer_id is null
  55.                                 AND user.customer_id is null
  56.                                 AND user.is_active = 1
  57.                                     ");
  58.         $this->addSql("                      
  59.                         INSERT INTO subscription_settings(user_id, event_id, own, _all, selected, no)
  60.                             SELECT user.id, e.id, false, false, false, true                            
  61.                             FROM user
  62.                             INNER JOIN event AS e
  63.                                 ON e.code = 'sample.transition.to_delivered'                                  
  64.                                 WHERE user.manufacturer_id is null
  65.                                 AND user.customer_id is null
  66.                                 AND user.is_active = 1
  67.                                     ");
  68.     }
  69.     public function down(Schema $schema): void
  70.     {
  71.     }
  72. }
  73. //WHERE user.manufacturer_id is null
  74. //AND user.customer_id is null
  75. //AND user.is_active = 1