<?php declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20190502125623 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$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');
$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');
$this->addSql('ALTER TABLE gym_exercise_exercise_focus ADD CONSTRAINT FK_8C0B5772CF565EB0 FOREIGN KEY (gym_exercise_id) REFERENCES gym_exercise (id) ON DELETE CASCADE');
$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');
$this->addSql('ALTER TABLE gym_exercise ADD `difficultyLevel` VARCHAR(255) DEFAULT NULL COMMENT \'(DC2Type:difficultyLevel)\'');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE gym_exercise_exercise_focus DROP FOREIGN KEY FK_8C0B5772DC410532');
$this->addSql('DROP TABLE gym_exercise_exercise_focus');
$this->addSql('DROP TABLE gym_exercise_focus');
$this->addSql('ALTER TABLE gym_exercise DROP `difficultyLevel`');
}
}