<?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 Version20230130171730 extends AbstractMigration
{
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE service_message_campaign (id INT AUTO_INCREMENT NOT NULL, service_id INT NOT NULL, message_id INT NOT NULL, start_date DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', end_date DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', deleted_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_B176F1DDED5CA9E6 (service_id), UNIQUE INDEX UNIQ_B176F1DD537A1329 (message_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE service_message_campaign_recipient (id INT AUTO_INCREMENT NOT NULL, campaign_id INT NOT NULL, message_log_id INT NOT NULL, job_id INT DEFAULT NULL, reply_received_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', deleted_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_E2C75577F639F774 (campaign_id), UNIQUE INDEX UNIQ_E2C75577DD40C089 (message_log_id), UNIQUE INDEX UNIQ_E2C75577BE04EA9 (job_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE service_message_campaign ADD CONSTRAINT FK_B176F1DDED5CA9E6 FOREIGN KEY (service_id) REFERENCES service (id)');
$this->addSql('ALTER TABLE service_message_campaign ADD CONSTRAINT FK_B176F1DD537A1329 FOREIGN KEY (message_id) REFERENCES message (id)');
$this->addSql('ALTER TABLE service_message_campaign_recipient ADD CONSTRAINT FK_E2C75577F639F774 FOREIGN KEY (campaign_id) REFERENCES service_message_campaign (id)');
$this->addSql('ALTER TABLE service_message_campaign_recipient ADD CONSTRAINT FK_E2C75577DD40C089 FOREIGN KEY (message_log_id) REFERENCES message_log (id)');
$this->addSql('ALTER TABLE service_message_campaign_recipient ADD CONSTRAINT FK_E2C75577BE04EA9 FOREIGN KEY (job_id) REFERENCES job (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE service_message_campaign DROP FOREIGN KEY FK_B176F1DDED5CA9E6');
$this->addSql('ALTER TABLE service_message_campaign DROP FOREIGN KEY FK_B176F1DD537A1329');
$this->addSql('ALTER TABLE service_message_campaign_recipient DROP FOREIGN KEY FK_E2C75577F639F774');
$this->addSql('ALTER TABLE service_message_campaign_recipient DROP FOREIGN KEY FK_E2C75577DD40C089');
$this->addSql('ALTER TABLE service_message_campaign_recipient DROP FOREIGN KEY FK_E2C75577BE04EA9');
$this->addSql('DROP TABLE service_message_campaign');
$this->addSql('DROP TABLE service_message_campaign_recipient');
}
}