<?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 Version20190814145519 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('CREATE TABLE config_source_grade (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, sort_order INT DEFAULT NULL, min_score_a INT DEFAULT NULL, max_score_a INT DEFAULT NULL, min_score_b INT DEFAULT NULL, max_score_b INT DEFAULT NULL, min_score_c INT DEFAULT NULL, max_score_c INT DEFAULT NULL, min_score_d INT DEFAULT NULL, max_score_d INT DEFAULT NULL, min_score_f INT DEFAULT NULL, max_score_f INT DEFAULT NULL, INDEX idx_name (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE source_grade_source (source_grade_id INT NOT NULL, source_id INT NOT NULL, INDEX IDX_10A57853BD39977A (source_grade_id), INDEX IDX_10A57853953C1C61 (source_id), PRIMARY KEY(source_grade_id, source_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE source_grade_source ADD CONSTRAINT FK_CBCF22D5BD39977A FOREIGN KEY (source_grade_id) REFERENCES config_source_grade (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE source_grade_source ADD CONSTRAINT FK_CBCF22D5953C1C61 FOREIGN KEY (source_id) REFERENCES config_source (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE config_source DROP min_score_a, DROP max_score_a, DROP min_score_b, DROP max_score_b, DROP min_score_c, DROP max_score_c, DROP min_score_d, DROP max_score_d, DROP min_score_f, DROP max_score_f');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE source_grade_source DROP FOREIGN KEY FK_CBCF22D5BD39977A');
$this->addSql('DROP TABLE config_source_grade');
$this->addSql('DROP TABLE source_grade_source');
$this->addSql('ALTER TABLE config_source ADD min_score_a INT DEFAULT NULL, ADD max_score_a INT DEFAULT NULL, ADD min_score_b INT DEFAULT NULL, ADD max_score_b INT DEFAULT NULL, ADD min_score_c INT DEFAULT NULL, ADD max_score_c INT DEFAULT NULL, ADD min_score_d INT DEFAULT NULL, ADD max_score_d INT DEFAULT NULL, ADD min_score_f INT DEFAULT NULL, ADD max_score_f INT DEFAULT NULL');
}
}