<?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 Version20220722003322 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 supply DROP FOREIGN KEY FK_D219948C4584665A');
$this->addSql('ALTER TABLE supply DROP FOREIGN KEY FK_D219948CE308AC6F');
$this->addSql('ALTER TABLE supply ADD Orders_material_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE supply ADD CONSTRAINT FK_D219948CCDF7C0C5 FOREIGN KEY (Orders_material_id) REFERENCES orders_material (id)');
$this->addSql('ALTER TABLE supply ADD CONSTRAINT FK_D219948C4584665A FOREIGN KEY (product_id) REFERENCES product (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE supply ADD CONSTRAINT FK_D219948CE308AC6F FOREIGN KEY (material_id) REFERENCES material (id) ON DELETE SET NULL');
$this->addSql('CREATE INDEX IDX_D219948CCDF7C0C5 ON supply (Orders_material_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE supply DROP FOREIGN KEY FK_D219948CCDF7C0C5');
$this->addSql('ALTER TABLE supply DROP FOREIGN KEY FK_D219948C4584665A');
$this->addSql('ALTER TABLE supply DROP FOREIGN KEY FK_D219948CE308AC6F');
$this->addSql('DROP INDEX IDX_D219948CCDF7C0C5 ON supply');
$this->addSql('ALTER TABLE supply DROP Orders_material_id');
$this->addSql('ALTER TABLE supply ADD CONSTRAINT FK_D219948C4584665A FOREIGN KEY (product_id) REFERENCES product (id)');
$this->addSql('ALTER TABLE supply ADD CONSTRAINT FK_D219948CE308AC6F FOREIGN KEY (material_id) REFERENCES material (id)');
}
}