migrations/Version20220902001010.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 Version20220902001010 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 equivalent_matter (id INT AUTO_INCREMENT NOT NULL, establishment_id INT NOT NULL, code VARCHAR(128) NOT NULL, `label` VARCHAR(128) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_by INT NOT NULL, updated_by INT NOT NULL, INDEX IDX_842652C28565851 (establishment_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE equivalent_matter ADD CONSTRAINT FK_842652C28565851 FOREIGN KEY (establishment_id) REFERENCES establishment (id)');
  20.         $this->addSql('ALTER TABLE school_matter ADD equivalent_matter_id INT DEFAULT NULL');
  21.         $this->addSql('ALTER TABLE school_matter ADD CONSTRAINT FK_4D6298A3AEEA3DB1 FOREIGN KEY (equivalent_matter_id) REFERENCES equivalent_matter (id)');
  22.         $this->addSql('CREATE INDEX IDX_4D6298A3AEEA3DB1 ON school_matter (equivalent_matter_id)');
  23.     }
  24.     public function down(Schema $schema): void
  25.     {
  26.         // this down() migration is auto-generated, please modify it to your needs
  27.         $this->addSql('ALTER TABLE school_matter DROP FOREIGN KEY FK_4D6298A3AEEA3DB1');
  28.         $this->addSql('DROP TABLE equivalent_matter');
  29.         $this->addSql('DROP INDEX IDX_4D6298A3AEEA3DB1 ON school_matter');
  30.         $this->addSql('ALTER TABLE school_matter DROP equivalent_matter_id');
  31.     }
  32. }