migrations/Version20240715183423.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20240715183423 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'deathnotice anniversary creation';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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');
  19.         $this->addSql('ALTER TABLE hf_death_notice_anniversary ADD CONSTRAINT FK_D271953AA01285CE FOREIGN KEY (death_notice_id) REFERENCES hf_death_notice (id)');
  20.         $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');
  21.         $this->addSql('CREATE UNIQUE INDEX UNIQ_661897509BE8FD98 ON eckinox_app_users (facebook_id)');
  22.         $this->addSql('ALTER TABLE hf_death_notice ADD death_notice_anniversary_id INT DEFAULT NULL');
  23.         $this->addSql('ALTER TABLE hf_death_notice ADD CONSTRAINT FK_B660FAF3F12E1935 FOREIGN KEY (death_notice_anniversary_id) REFERENCES hf_death_notice_anniversary (id)');
  24.         $this->addSql('CREATE UNIQUE INDEX UNIQ_B660FAF3F12E1935 ON hf_death_notice (death_notice_anniversary_id)');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         // this down() migration is auto-generated, please modify it to your needs
  29.         $this->addSql('ALTER TABLE hf_death_notice DROP FOREIGN KEY FK_B660FAF3F12E1935');
  30.         $this->addSql('ALTER TABLE hf_death_notice_anniversary DROP FOREIGN KEY FK_D271953AA01285CE');
  31.         $this->addSql('ALTER TABLE hf_death_notice_anniversary DROP FOREIGN KEY FK_D271953A43474211');
  32.         $this->addSql('DROP TABLE hf_death_notice_anniversary');
  33.         $this->addSql('DROP INDEX UNIQ_661897509BE8FD98 ON eckinox_app_users');
  34.         $this->addSql('DROP INDEX UNIQ_B660FAF3F12E1935 ON hf_death_notice');
  35.         $this->addSql('ALTER TABLE hf_death_notice DROP death_notice_anniversary_id');
  36.     }
  37. }