<?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 Version20211020060536 extends AbstractMigration
{
public function getDescription(): string
{
return 'Added company_demand table';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE company_demand (id INT AUTO_INCREMENT NOT NULL, demand_id INT NOT NULL, company_id INT NOT NULL, selected TINYINT(1) NOT NULL, INDEX IDX_7F121D065D022E59 (demand_id), INDEX IDX_7F121D06979B1AD6 (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE company_demand ADD CONSTRAINT FK_7F121D065D022E59 FOREIGN KEY (demand_id) REFERENCES demand (id)');
$this->addSql('ALTER TABLE company_demand ADD CONSTRAINT FK_7F121D06979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
$this->addSql('ALTER TABLE demand DROP FOREIGN KEY FK_428D7973979B1AD6');
$this->addSql('DROP INDEX IDX_428D7973979B1AD6 ON demand');
$this->addSql('ALTER TABLE demand DROP 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_demand');
$this->addSql('ALTER TABLE demand ADD company_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE demand ADD CONSTRAINT FK_428D7973979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id)');
$this->addSql('CREATE INDEX IDX_428D7973979B1AD6 ON demand (company_id)');
}
}