<?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 Version20240731071031 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 company_plans (id INT AUTO_INCREMENT NOT NULL, company_id INT NOT NULL, service_id INT NOT NULL, units INT NOT NULL, INDEX IDX_72963AB4979B1AD6 (company_id), INDEX IDX_72963AB4ED5CA9E6 (service_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE company_plans ADD CONSTRAINT FK_72963AB4979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
$this->addSql('ALTER TABLE company_plans ADD CONSTRAINT FK_72963AB4ED5CA9E6 FOREIGN KEY (service_id) REFERENCES service (id)');
$this->addSql('ALTER TABLE customer_subscription ADD company_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE customer_subscription ADD CONSTRAINT FK_AD1EA7CA979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
$this->addSql('CREATE INDEX IDX_AD1EA7CA979B1AD6 ON customer_subscription (company_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE company_plans');
$this->addSql('ALTER TABLE customer_subscription DROP FOREIGN KEY FK_AD1EA7CA979B1AD6');
$this->addSql('DROP INDEX IDX_AD1EA7CA979B1AD6 ON customer_subscription');
$this->addSql('ALTER TABLE customer_subscription DROP company_id');
}
}