<?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 Version20241209115327 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 suppliers__brands_discount (id INT AUTO_INCREMENT NOT NULL, supplier_id INT NOT NULL, brand_id INT NOT NULL, discount INT DEFAULT 0 NOT NULL, updated DATETIME DEFAULT NULL, INDEX IDX_A81356162ADD6D8C (supplier_id), INDEX IDX_A813561644F5D008 (brand_id), UNIQUE INDEX UNIQ_A81356162ADD6D8C44F5D008 (supplier_id, brand_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE suppliers__markups (id INT AUTO_INCREMENT NOT NULL, supplier_id INT NOT NULL, markup INT DEFAULT 0 NOT NULL, updated DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_FA42635F2ADD6D8C (supplier_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE suppliers__markups_ranges (id INT AUTO_INCREMENT NOT NULL, supplier_id INT NOT NULL, markup INT DEFAULT 0 NOT NULL, range_from INT DEFAULT 0 NOT NULL, range_to INT DEFAULT 0 NOT NULL, updated DATETIME DEFAULT NULL, INDEX IDX_7DBB4FA62ADD6D8C (supplier_id), UNIQUE INDEX UNIQ_7DBB4FA62ADD6D8CAB7AD049423C6525 (supplier_id, range_from, range_to), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE suppliers__brands_discount ADD CONSTRAINT FK_A81356162ADD6D8C FOREIGN KEY (supplier_id) REFERENCES suppliers__suppliers (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE suppliers__brands_discount ADD CONSTRAINT FK_A813561644F5D008 FOREIGN KEY (brand_id) REFERENCES brands__brands (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE suppliers__markups ADD CONSTRAINT FK_FA42635F2ADD6D8C FOREIGN KEY (supplier_id) REFERENCES suppliers__suppliers (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE suppliers__markups_ranges ADD CONSTRAINT FK_7DBB4FA62ADD6D8C FOREIGN KEY (supplier_id) REFERENCES suppliers__suppliers (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 suppliers__brands_discount DROP FOREIGN KEY FK_A81356162ADD6D8C');
$this->addSql('ALTER TABLE suppliers__brands_discount DROP FOREIGN KEY FK_A813561644F5D008');
$this->addSql('ALTER TABLE suppliers__markups DROP FOREIGN KEY FK_FA42635F2ADD6D8C');
$this->addSql('ALTER TABLE suppliers__markups_ranges DROP FOREIGN KEY FK_7DBB4FA62ADD6D8C');
$this->addSql('DROP TABLE suppliers__brands_discount');
$this->addSql('DROP TABLE suppliers__markups');
$this->addSql('DROP TABLE suppliers__markups_ranges');
}
}