migrations/Version20250922114357.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20250922114357 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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');
  19.         $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');
  20.         $this->addSql('ALTER TABLE voucher_company ADD CONSTRAINT FK_8C72234828AA1B6F FOREIGN KEY (voucher_id) REFERENCES voucher (id) ON DELETE CASCADE');
  21.         $this->addSql('ALTER TABLE voucher_company ADD CONSTRAINT FK_8C722348979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id) ON DELETE CASCADE');
  22.         $this->addSql('ALTER TABLE voucher_tariff ADD CONSTRAINT FK_55C1868028AA1B6F FOREIGN KEY (voucher_id) REFERENCES voucher (id) ON DELETE CASCADE');
  23.         $this->addSql('ALTER TABLE voucher_tariff ADD CONSTRAINT FK_55C1868092348FD2 FOREIGN KEY (tariff_id) REFERENCES tariff (id) ON DELETE CASCADE');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('ALTER TABLE voucher_company DROP FOREIGN KEY FK_8C72234828AA1B6F');
  29.         $this->addSql('ALTER TABLE voucher_company DROP FOREIGN KEY FK_8C722348979B1AD6');
  30.         $this->addSql('ALTER TABLE voucher_tariff DROP FOREIGN KEY FK_55C1868028AA1B6F');
  31.         $this->addSql('ALTER TABLE voucher_tariff DROP FOREIGN KEY FK_55C1868092348FD2');
  32.         $this->addSql('DROP TABLE voucher_company');
  33.         $this->addSql('DROP TABLE voucher_tariff');
  34.     }
  35. }