LaLiga-BackEnd/migrations/Version20240307211223.php

50 lines
2.6 KiB
PHP

<?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 Version20240307211223 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 league DROP FOREIGN KEY FK_3EB4C318B40A33C7');
$this->addSql('DROP INDEX UNIQ_3EB4C318B40A33C7 ON league');
$this->addSql('ALTER TABLE league DROP president_id');
$this->addSql('ALTER TABLE notification DROP FOREIGN KEY FK_NOTIFICATION_REQUESTING_USER_ID');
$this->addSql('DROP INDEX IDX_BF5476CA2A841BBC ON notification');
$this->addSql('ALTER TABLE notification ADD user_to_notify_id INT NOT NULL, CHANGE requesting_user_id user_who_fired_event_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE notification ADD CONSTRAINT FK_BF5476CA6EEF4E6F FOREIGN KEY (user_who_fired_event_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE notification ADD CONSTRAINT FK_BF5476CA64958C8F FOREIGN KEY (user_to_notify_id) REFERENCES user (id)');
$this->addSql('CREATE INDEX IDX_BF5476CA6EEF4E6F ON notification (user_who_fired_event_id)');
$this->addSql('CREATE INDEX IDX_BF5476CA64958C8F ON notification (user_to_notify_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE league ADD president_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE league ADD CONSTRAINT FK_3EB4C318B40A33C7 FOREIGN KEY (president_id) REFERENCES user (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_3EB4C318B40A33C7 ON league (president_id)');
$this->addSql('ALTER TABLE notification DROP FOREIGN KEY FK_BF5476CA6EEF4E6F');
$this->addSql('ALTER TABLE notification DROP FOREIGN KEY FK_BF5476CA64958C8F');
$this->addSql('DROP INDEX IDX_BF5476CA6EEF4E6F ON notification');
$this->addSql('DROP INDEX IDX_BF5476CA64958C8F ON notification');
$this->addSql('ALTER TABLE notification DROP user_to_notify_id, CHANGE user_who_fired_event_id requesting_user_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE notification ADD CONSTRAINT FK_NOTIFICATION_REQUESTING_USER_ID FOREIGN KEY (requesting_user_id) REFERENCES user (id)');
$this->addSql('CREATE INDEX IDX_BF5476CA2A841BBC ON notification (requesting_user_id)');
}
}