migrations/Version20220218100617.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 Version20220218100617 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 gh_rooms (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, short VARCHAR(20) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE gh_courses ADD CONSTRAINT FK_8FC5309B54177093 FOREIGN KEY (room_id) REFERENCES gh_rooms (id)');
  20.         $this->addSql('ALTER TABLE gh_courses ADD CONSTRAINT FK_8FC5309B8C4FC193 FOREIGN KEY (instructor_id) REFERENCES gh_addresses (id)');
  21.         $this->addSql('ALTER TABLE gh_courses ADD CONSTRAINT FK_8FC5309BAD530F42 FOREIGN KEY (instructor2_id) REFERENCES gh_addresses (id)');
  22.         $this->addSql('CREATE INDEX IDX_8FC5309B8C4FC193 ON gh_courses (instructor_id)');
  23.         $this->addSql('CREATE INDEX IDX_8FC5309BAD530F42 ON gh_courses (instructor2_id)');
  24.         $this->addSql('CREATE INDEX IDX_8FC5309B54177093 ON gh_courses (room_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('DROP TABLE gh_rooms');
  30.         $this->addSql('ALTER TABLE gh_courses DROP FOREIGN KEY FK_8FC5309B8C4FC193');
  31.         $this->addSql('ALTER TABLE gh_courses DROP FOREIGN KEY FK_8FC5309BAD530F42');
  32.         $this->addSql('DROP INDEX IDX_8FC5309BAD530F42 ON gh_courses');
  33.         $this->addSql('DROP INDEX IDX_8FC5309B8C4FC193 ON gh_courses');
  34.         $this->addSql('DROP INDEX IDX_8FC5309B54177093 ON gh_courses');
  35.     }
  36. }