<?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 Version20231226104050 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->addSql('DELETE FROM notification_token');
$this->addSql('ALTER TABLE notification_token DROP FOREIGN KEY FK_998344C24D2A7E12');
$this->addSql('DROP INDEX IDX_998344C24D2A7E12 ON notification_token');
$this->addSql('ALTER TABLE notification_token ADD resident_id INT DEFAULT NULL, DROP building_id');
$this->addSql('ALTER TABLE notification_token ADD CONSTRAINT FK_998344C28012C5B0 FOREIGN KEY (resident_id) REFERENCES residents (id) ON DELETE CASCADE');
$this->addSql('CREATE UNIQUE INDEX UNIQ_998344C28012C5B0 ON notification_token (resident_id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE notification_token DROP FOREIGN KEY FK_998344C28012C5B0');
$this->addSql('DROP INDEX UNIQ_998344C28012C5B0 ON notification_token');
$this->addSql('ALTER TABLE notification_token ADD building_id INT NOT NULL, DROP resident_id');
$this->addSql('ALTER TABLE notification_token ADD CONSTRAINT FK_998344C24D2A7E12 FOREIGN KEY (building_id) REFERENCES building (id) ON DELETE CASCADE');
$this->addSql('CREATE INDEX IDX_998344C24D2A7E12 ON notification_token (building_id)');
}
}