migrations/Version20220627072457.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 Version20220627072457 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('CREATE TABLE incident_entity_option (incident_id INT NOT NULL, entity_option_id INT NOT NULL, INDEX IDX_DF7C7B6859E53FB9 (incident_id), INDEX IDX_DF7C7B68D1BAA843 (entity_option_id), PRIMARY KEY(incident_id, entity_option_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE incident_entity_option ADD CONSTRAINT FK_DF7C7B6859E53FB9 FOREIGN KEY (incident_id) REFERENCES incident (id) ON DELETE CASCADE');
  20.         $this->addSql('ALTER TABLE incident_entity_option ADD CONSTRAINT FK_DF7C7B68D1BAA843 FOREIGN KEY (entity_option_id) REFERENCES entity_option (id) ON DELETE CASCADE');
  21.         $this->addSql('ALTER TABLE incident DROP FOREIGN KEY FK_3D03A11A32C92DC9');
  22.         $this->addSql('DROP INDEX IDX_3D03A11A32C92DC9 ON incident');
  23.         $this->addSql('ALTER TABLE incident DROP parent_incident_id');
  24.         $this->addSql('ALTER TABLE person CHANGE created_at created_at DATETIME DEFAULT NULL, CHANGE updated_at updated_at DATETIME DEFAULT NULL');
  25.         $this->addSql('ALTER TABLE place CHANGE created_at created_at DATETIME DEFAULT NULL, CHANGE updated_at updated_at DATETIME DEFAULT NULL');
  26.     }
  27.     public function down(Schema $schema): void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->addSql('DROP TABLE incident_entity_option');
  31.         $this->addSql('ALTER TABLE incident ADD parent_incident_id INT DEFAULT NULL');
  32.         $this->addSql('ALTER TABLE incident ADD CONSTRAINT FK_3D03A11A32C92DC9 FOREIGN KEY (parent_incident_id) REFERENCES incident (id)');
  33.         $this->addSql('CREATE INDEX IDX_3D03A11A32C92DC9 ON incident (parent_incident_id)');
  34.         $this->addSql('ALTER TABLE person CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL');
  35.         $this->addSql('ALTER TABLE place CHANGE created_at created_at DATETIME NOT NULL, CHANGE updated_at updated_at DATETIME NOT NULL');
  36.     }
  37. }