<?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 Version20220603142836 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('CREATE TABLE vins_pb_price_quantity (vins_pb_id INT NOT NULL, price_quantity_id INT NOT NULL, INDEX IDX_4B70F3CFFCD9AB2E (vins_pb_id), INDEX IDX_4B70F3CF795206EA (price_quantity_id), PRIMARY KEY(vins_pb_id, price_quantity_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE vins_pb_price_quantity ADD CONSTRAINT FK_4B70F3CFFCD9AB2E FOREIGN KEY (vins_pb_id) REFERENCES vins_pb (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE vins_pb_price_quantity ADD CONSTRAINT FK_4B70F3CF795206EA FOREIGN KEY (price_quantity_id) REFERENCES price_quantity (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE categorie_vin ADD category_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE categorie_vin ADD CONSTRAINT FK_9FBF904012469DE2 FOREIGN KEY (category_id) REFERENCES categories (id)');
$this->addSql('CREATE INDEX IDX_9FBF904012469DE2 ON categorie_vin (category_id)');
$this->addSql('ALTER TABLE vins_au_verre ADD category_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE vins_au_verre ADD CONSTRAINT FK_40AE7B0812469DE2 FOREIGN KEY (category_id) REFERENCES categorie_vin (id)');
$this->addSql('CREATE INDEX IDX_40AE7B0812469DE2 ON vins_au_verre (category_id)');
$this->addSql('ALTER TABLE vins_pb ADD category_vin_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE vins_pb ADD CONSTRAINT FK_89C4B2ACB58A0C2A FOREIGN KEY (category_vin_id) REFERENCES categorie_vin (id)');
$this->addSql('CREATE INDEX IDX_89C4B2ACB58A0C2A ON vins_pb (category_vin_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE vins_pb_price_quantity');
$this->addSql('ALTER TABLE categorie_vin DROP FOREIGN KEY FK_9FBF904012469DE2');
$this->addSql('DROP INDEX IDX_9FBF904012469DE2 ON categorie_vin');
$this->addSql('ALTER TABLE categorie_vin DROP category_id');
$this->addSql('ALTER TABLE vins_au_verre DROP FOREIGN KEY FK_40AE7B0812469DE2');
$this->addSql('DROP INDEX IDX_40AE7B0812469DE2 ON vins_au_verre');
$this->addSql('ALTER TABLE vins_au_verre DROP category_id');
$this->addSql('ALTER TABLE vins_pb DROP FOREIGN KEY FK_89C4B2ACB58A0C2A');
$this->addSql('DROP INDEX IDX_89C4B2ACB58A0C2A ON vins_pb');
$this->addSql('ALTER TABLE vins_pb DROP category_vin_id');
}
}