migrations/Version20190502125623.php line 1

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace DoctrineMigrations;
  3. use Doctrine\DBAL\Schema\Schema;
  4. use Doctrine\Migrations\AbstractMigration;
  5. /**
  6.  * Auto-generated Migration: Please modify to your needs!
  7.  */
  8. final class Version20190502125623 extends AbstractMigration
  9. {
  10.     public function up(Schema $schema) : void
  11.     {
  12.         // this up() migration is auto-generated, please modify it to your needs
  13.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  14.         $this->addSql('CREATE TABLE gym_exercise_exercise_focus (gym_exercise_id INT NOT NULL, gym_exercise_focus_id INT NOT NULL, INDEX IDX_8C0B5772CF565EB0 (gym_exercise_id), INDEX IDX_8C0B5772DC410532 (gym_exercise_focus_id), PRIMARY KEY(gym_exercise_id, gym_exercise_focus_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
  15.         $this->addSql('CREATE TABLE gym_exercise_focus (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_18AB6B4A5E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
  16.         $this->addSql('ALTER TABLE gym_exercise_exercise_focus ADD CONSTRAINT FK_8C0B5772CF565EB0 FOREIGN KEY (gym_exercise_id) REFERENCES gym_exercise (id) ON DELETE CASCADE');
  17.         $this->addSql('ALTER TABLE gym_exercise_exercise_focus ADD CONSTRAINT FK_8C0B5772DC410532 FOREIGN KEY (gym_exercise_focus_id) REFERENCES gym_exercise_focus (id) ON DELETE CASCADE');
  18.         $this->addSql('ALTER TABLE gym_exercise ADD `difficultyLevel` VARCHAR(255) DEFAULT NULL COMMENT \'(DC2Type:difficultyLevel)\'');
  19.     }
  20.     public function down(Schema $schema) : void
  21.     {
  22.         // this down() migration is auto-generated, please modify it to your needs
  23.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  24.         $this->addSql('ALTER TABLE gym_exercise_exercise_focus DROP FOREIGN KEY FK_8C0B5772DC410532');
  25.         $this->addSql('DROP TABLE gym_exercise_exercise_focus');
  26.         $this->addSql('DROP TABLE gym_exercise_focus');
  27.         $this->addSql('ALTER TABLE gym_exercise DROP `difficultyLevel`');
  28.     }
  29. }