<?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 Version20220620013541 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 product_material ADD id INT AUTO_INCREMENT NOT NULL, CHANGE product_id product_id INT DEFAULT NULL, CHANGE material_id material_id INT DEFAULT NULL, DROP PRIMARY KEY, ADD PRIMARY KEY (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE product_material MODIFY id INT NOT NULL');
$this->addSql('ALTER TABLE product_material DROP PRIMARY KEY');
$this->addSql('ALTER TABLE product_material DROP id, CHANGE product_id product_id INT NOT NULL, CHANGE material_id material_id INT NOT NULL');
$this->addSql('ALTER TABLE product_material ADD PRIMARY KEY (product_id, material_id)');
}
}