<?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 Version20250823125800 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 product_label (id INT AUTO_INCREMENT NOT NULL, text VARCHAR(255) NOT NULL, color VARCHAR(255) NOT NULL, visible TINYINT(1) NOT NULL, priority INT NOT NULL, type VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE product_label_product (product_label_id INT NOT NULL, product_id INT NOT NULL, INDEX IDX_B526B176F80945AE (product_label_id), INDEX IDX_B526B1764584665A (product_id), PRIMARY KEY(product_label_id, product_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE product_label_product ADD CONSTRAINT FK_B526B176F80945AE FOREIGN KEY (product_label_id) REFERENCES product_label (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE product_label_product ADD CONSTRAINT FK_B526B1764584665A FOREIGN KEY (product_id) REFERENCES product (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE product_label_product DROP FOREIGN KEY FK_B526B176F80945AE');
$this->addSql('ALTER TABLE product_label_product DROP FOREIGN KEY FK_B526B1764584665A');
$this->addSql('ALTER TABLE promo_code_product DROP FOREIGN KEY FK_73EB87262FAE4625');
$this->addSql('ALTER TABLE promo_code_product DROP FOREIGN KEY FK_73EB87264584665A');
$this->addSql('DROP TABLE product_label');
$this->addSql('DROP TABLE product_label_product');
}
}