<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20221012213608 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE message (id INT AUTO_INCREMENT NOT NULL, job_id INT DEFAULT NULL, message VARCHAR(255) NOT NULL, subject VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_B6BD307FBE04EA9 (job_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FBE04EA9 FOREIGN KEY (job_id) REFERENCES job (id)');
$this->addSql('ALTER TABLE message_log DROP FOREIGN KEY FK_A60AE229BE04EA9');
$this->addSql('DROP INDEX IDX_A60AE229BE04EA9 ON message_log');
$this->addSql('ALTER TABLE message_log DROP message, CHANGE job_id message_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE message_log ADD CONSTRAINT FK_A60AE229537A1329 FOREIGN KEY (message_id) REFERENCES message (id)');
$this->addSql('CREATE INDEX IDX_A60AE229537A1329 ON message_log (message_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE message_log DROP FOREIGN KEY FK_A60AE229537A1329');
$this->addSql('ALTER TABLE message DROP FOREIGN KEY FK_B6BD307FBE04EA9');
$this->addSql('DROP TABLE message');
$this->addSql('DROP INDEX IDX_A60AE229537A1329 ON message_log');
$this->addSql('ALTER TABLE message_log ADD message VARCHAR(255) NOT NULL, CHANGE message_id job_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE message_log ADD CONSTRAINT FK_A60AE229BE04EA9 FOREIGN KEY (job_id) REFERENCES job (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
$this->addSql('CREATE INDEX IDX_A60AE229BE04EA9 ON message_log (job_id)');
}
}