migrations/Version20220422090729.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 Version20220422090729 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  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('DROP INDEX IDX_C42F7784158E0B66 ON report');
  19.         $this->addSql('ALTER TABLE report ADD society_id INT DEFAULT NULL, ADD profile_id INT DEFAULT NULL, DROP target_id');
  20.         $this->addSql('ALTER TABLE report ADD CONSTRAINT FK_C42F7784E6389D24 FOREIGN KEY (society_id) REFERENCES society (id)');
  21.         $this->addSql('ALTER TABLE report ADD CONSTRAINT FK_C42F7784CCFA12B8 FOREIGN KEY (profile_id) REFERENCES profile (id)');
  22.         $this->addSql('CREATE INDEX IDX_C42F7784E6389D24 ON report (society_id)');
  23.         $this->addSql('CREATE INDEX IDX_C42F7784CCFA12B8 ON report (profile_id)');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('ALTER TABLE report DROP FOREIGN KEY FK_C42F7784E6389D24');
  29.         $this->addSql('ALTER TABLE report DROP FOREIGN KEY FK_C42F7784CCFA12B8');
  30.         $this->addSql('DROP INDEX IDX_C42F7784E6389D24 ON report');
  31.         $this->addSql('DROP INDEX IDX_C42F7784CCFA12B8 ON report');
  32.         $this->addSql('ALTER TABLE report ADD target_id INT NOT NULL, DROP society_id, DROP profile_id');
  33.         $this->addSql('CREATE INDEX IDX_C42F7784158E0B66 ON report (target_id)');
  34.     }
  35. }