<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220207082803 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql("
INSERT INTO subscription_settings(user_id, event_id, own, _all, selected, no)
SELECT user.id, e.id, false, false, false, true
FROM user
INNER JOIN event AS e
ON e.code = 'sample.transition.to_producing'
WHERE user.manufacturer_id is null
AND user.customer_id is null
AND user.is_active = 1
");
$this->addSql("
INSERT INTO subscription_settings(user_id, event_id, own, _all, selected, no)
SELECT user.id, e.id, false, false, false, true
FROM user
INNER JOIN event AS e
ON e.code = 'sample.transition.to_transit_to_office'
WHERE user.manufacturer_id is null
AND user.customer_id is null
AND user.is_active = 1
");
$this->addSql("
INSERT INTO subscription_settings(user_id, event_id, own, _all, selected, no)
SELECT user.id, e.id, false, false, false, true
FROM user
INNER JOIN event AS e
ON e.code = 'sample.transition.to_office'
WHERE user.manufacturer_id is null
AND user.customer_id is null
AND user.is_active = 1
");
$this->addSql("
INSERT INTO subscription_settings(user_id, event_id, own, _all, selected, no)
SELECT user.id, e.id, false, false, false, true
FROM user
INNER JOIN event AS e
ON e.code = 'sample.transition.to_transit_to_customer'
WHERE user.manufacturer_id is null
AND user.customer_id is null
AND user.is_active = 1
");
$this->addSql("
INSERT INTO subscription_settings(user_id, event_id, own, _all, selected, no)
SELECT user.id, e.id, false, false, false, true
FROM user
INNER JOIN event AS e
ON e.code = 'sample.transition.to_delivered'
WHERE user.manufacturer_id is null
AND user.customer_id is null
AND user.is_active = 1
");
}
public function down(Schema $schema): void
{
}
}
//WHERE user.manufacturer_id is null
//AND user.customer_id is null
//AND user.is_active = 1