<?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 Version20200114172623 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_stage_item_join_config_stage_category (item_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_A18CADFD126F525E (item_id), INDEX IDX_A18CADFD12469DE2 (category_id), PRIMARY KEY(item_id, category_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('CREATE TABLE config_stage_category (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, INDEX idx_name (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE config_stage_item_join_config_stage_category ADD CONSTRAINT FK_A18CADFD126F525E FOREIGN KEY (item_id) REFERENCES config_stage_item (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE config_stage_item_join_config_stage_category ADD CONSTRAINT FK_A18CADFD12469DE2 FOREIGN KEY (category_id) REFERENCES config_stage_category (id) ON DELETE CASCADE');
}
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 config_stage_item_join_config_stage_category DROP FOREIGN KEY FK_A18CADFD12469DE2');
$this->addSql('DROP TABLE config_stage_item_join_config_stage_category');
$this->addSql('DROP TABLE config_stage_category');
}
}