<?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 Version20250922114357 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 voucher_company (voucher_id INT NOT NULL, company_id INT NOT NULL, INDEX IDX_8C72234828AA1B6F (voucher_id), INDEX IDX_8C722348979B1AD6 (company_id), PRIMARY KEY(voucher_id, company_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE voucher_tariff (voucher_id INT NOT NULL, tariff_id INT NOT NULL, INDEX IDX_55C1868028AA1B6F (voucher_id), INDEX IDX_55C1868092348FD2 (tariff_id), PRIMARY KEY(voucher_id, tariff_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE voucher_company ADD CONSTRAINT FK_8C72234828AA1B6F FOREIGN KEY (voucher_id) REFERENCES voucher (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE voucher_company ADD CONSTRAINT FK_8C722348979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE voucher_tariff ADD CONSTRAINT FK_55C1868028AA1B6F FOREIGN KEY (voucher_id) REFERENCES voucher (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE voucher_tariff ADD CONSTRAINT FK_55C1868092348FD2 FOREIGN KEY (tariff_id) REFERENCES tariff (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 voucher_company DROP FOREIGN KEY FK_8C72234828AA1B6F');
$this->addSql('ALTER TABLE voucher_company DROP FOREIGN KEY FK_8C722348979B1AD6');
$this->addSql('ALTER TABLE voucher_tariff DROP FOREIGN KEY FK_55C1868028AA1B6F');
$this->addSql('ALTER TABLE voucher_tariff DROP FOREIGN KEY FK_55C1868092348FD2');
$this->addSql('DROP TABLE voucher_company');
$this->addSql('DROP TABLE voucher_tariff');
}
}