<?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 Version20220607093838 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 bieres_price_quantity (bieres_id INT NOT NULL, price_quantity_id INT NOT NULL, INDEX IDX_FE1965B750422F9 (bieres_id), INDEX IDX_FE1965B795206EA (price_quantity_id), PRIMARY KEY(bieres_id, price_quantity_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE bieres_price_quantity ADD CONSTRAINT FK_FE1965B750422F9 FOREIGN KEY (bieres_id) REFERENCES bieres (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE bieres_price_quantity ADD CONSTRAINT FK_FE1965B795206EA FOREIGN KEY (price_quantity_id) REFERENCES price_quantity (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE bieres ADD category_id INT DEFAULT NULL, ADD name VARCHAR(255) DEFAULT NULL, ADD brand VARCHAR(255) DEFAULT NULL, ADD logo_filename VARCHAR(255) DEFAULT NULL, ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL, DROP nom, DROP sous_nom, DROP logo');
$this->addSql('ALTER TABLE bieres ADD CONSTRAINT FK_EAD71EA512469DE2 FOREIGN KEY (category_id) REFERENCES categories (id)');
$this->addSql('CREATE INDEX IDX_EAD71EA512469DE2 ON bieres (category_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE bieres_price_quantity');
$this->addSql('ALTER TABLE bieres DROP FOREIGN KEY FK_EAD71EA512469DE2');
$this->addSql('DROP INDEX IDX_EAD71EA512469DE2 ON bieres');
$this->addSql('ALTER TABLE bieres ADD nom VARCHAR(255) DEFAULT NULL, ADD sous_nom VARCHAR(255) DEFAULT NULL, ADD logo VARCHAR(255) DEFAULT NULL, DROP category_id, DROP name, DROP brand, DROP logo_filename, DROP created_at, DROP updated_at');
}
}