<?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 Version20220929004132 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('ALTER TABLE debate ADD last_message_id INT DEFAULT NULL, ADD updated_at DATETIME DEFAULT NULL');
$this->addSql('ALTER TABLE debate ADD CONSTRAINT FK_DDC4A368BA0E79C3 FOREIGN KEY (last_message_id) REFERENCES debate_message (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_DDC4A368BA0E79C3 ON debate (last_message_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE debate DROP FOREIGN KEY FK_DDC4A368BA0E79C3');
$this->addSql('DROP INDEX UNIQ_DDC4A368BA0E79C3 ON debate');
$this->addSql('ALTER TABLE debate DROP last_message_id, DROP updated_at');
}
}