<?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 Version20240715183423 extends AbstractMigration
{
public function getDescription(): string
{
return 'deathnotice anniversary creation';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE hf_death_notice_anniversary (id INT AUTO_INCREMENT NOT NULL, death_notice_id INT NOT NULL, funeral_group_id INT DEFAULT NULL, anniversary_date DATE NOT NULL, publication_date DATE NOT NULL, description LONGTEXT DEFAULT NULL, creation_date DATETIME NOT NULL, UNIQUE INDEX UNIQ_D271953AA01285CE (death_notice_id), INDEX IDX_D271953A43474211 (funeral_group_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE hf_death_notice_anniversary ADD CONSTRAINT FK_D271953AA01285CE FOREIGN KEY (death_notice_id) REFERENCES hf_death_notice (id)');
$this->addSql('ALTER TABLE hf_death_notice_anniversary ADD CONSTRAINT FK_D271953A43474211 FOREIGN KEY (funeral_group_id) REFERENCES hf_funeral_group (id) ON DELETE SET NULL');
$this->addSql('CREATE UNIQUE INDEX UNIQ_661897509BE8FD98 ON eckinox_app_users (facebook_id)');
$this->addSql('ALTER TABLE hf_death_notice ADD death_notice_anniversary_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE hf_death_notice ADD CONSTRAINT FK_B660FAF3F12E1935 FOREIGN KEY (death_notice_anniversary_id) REFERENCES hf_death_notice_anniversary (id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_B660FAF3F12E1935 ON hf_death_notice (death_notice_anniversary_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE hf_death_notice DROP FOREIGN KEY FK_B660FAF3F12E1935');
$this->addSql('ALTER TABLE hf_death_notice_anniversary DROP FOREIGN KEY FK_D271953AA01285CE');
$this->addSql('ALTER TABLE hf_death_notice_anniversary DROP FOREIGN KEY FK_D271953A43474211');
$this->addSql('DROP TABLE hf_death_notice_anniversary');
$this->addSql('DROP INDEX UNIQ_661897509BE8FD98 ON eckinox_app_users');
$this->addSql('DROP INDEX UNIQ_B660FAF3F12E1935 ON hf_death_notice');
$this->addSql('ALTER TABLE hf_death_notice DROP death_notice_anniversary_id');
}
}