<?php
declare(strict_types=1);
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220112150727 extends AbstractMigration
{
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE messaging_request ADD assigned_by_id INT DEFAULT NULL, ADD assigned_to_id INT DEFAULT NULL, ADD assigned_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:carbondatetime)\'');
$this->addSql('ALTER TABLE messaging_request ADD CONSTRAINT FK_136434BF6E6F1246 FOREIGN KEY (assigned_by_id) REFERENCES security_user (id)');
$this->addSql('ALTER TABLE messaging_request ADD CONSTRAINT FK_136434BFF4BD7827 FOREIGN KEY (assigned_to_id) REFERENCES security_user (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_136434BF6E6F1246 ON messaging_request (assigned_by_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_136434BFF4BD7827 ON messaging_request (assigned_to_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE messaging_request DROP FOREIGN KEY FK_136434BF6E6F1246');
$this->addSql('ALTER TABLE messaging_request DROP FOREIGN KEY FK_136434BFF4BD7827');
$this->addSql('DROP INDEX UNIQ_136434BF6E6F1246 ON messaging_request');
$this->addSql('DROP INDEX UNIQ_136434BFF4BD7827 ON messaging_request');
$this->addSql('ALTER TABLE messaging_request DROP assigned_by_id, DROP assigned_to_id, DROP assigned_at');
}
}