<?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 Version20220821131342 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->addSql('ALTER TABLE price_map ADD material_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE price_map ADD CONSTRAINT FK_C6C1A134E308AC6F FOREIGN KEY (material_id) REFERENCES material (id)');
$this->addSql('CREATE INDEX IDX_C6C1A134E308AC6F ON price_map (material_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE price_map_material (price_map_id INT NOT NULL, material_id INT NOT NULL, INDEX IDX_EA9F2FAF1E5CF734 (price_map_id), INDEX IDX_EA9F2FAFE308AC6F (material_id), PRIMARY KEY(price_map_id, material_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE price_map_material ADD CONSTRAINT FK_EA9F2FAF1E5CF734 FOREIGN KEY (price_map_id) REFERENCES price_map (id) ON UPDATE NO ACTION ON DELETE CASCADE');
$this->addSql('ALTER TABLE price_map_material ADD CONSTRAINT FK_EA9F2FAFE308AC6F FOREIGN KEY (material_id) REFERENCES material (id) ON UPDATE NO ACTION ON DELETE CASCADE');
$this->addSql('ALTER TABLE price_map DROP FOREIGN KEY FK_C6C1A134E308AC6F');
$this->addSql('DROP INDEX IDX_C6C1A134E308AC6F ON price_map');
$this->addSql('ALTER TABLE price_map DROP material_id');
}
}