<?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 Version20220623074253 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 specialist_company (specialist_id INT NOT NULL, company_id INT NOT NULL, INDEX IDX_29D156807B100C1A (specialist_id), INDEX IDX_29D15680979B1AD6 (company_id), PRIMARY KEY(specialist_id, company_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE specialist_company ADD CONSTRAINT FK_29D156807B100C1A FOREIGN KEY (specialist_id) REFERENCES specialist (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE specialist_company ADD CONSTRAINT FK_29D15680979B1AD6 FOREIGN KEY (company_id) REFERENCES company (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE specialist ADD affiliated_company_id INT DEFAULT NULL, ADD is_affiliated TINYINT(1) DEFAULT NULL');
$this->addSql('ALTER TABLE specialist ADD CONSTRAINT FK_C2274AF45256794D FOREIGN KEY (affiliated_company_id) REFERENCES company (id)');
$this->addSql('CREATE INDEX IDX_C2274AF45256794D ON specialist (affiliated_company_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE specialist_company');
$this->addSql('ALTER TABLE specialist DROP FOREIGN KEY FK_C2274AF45256794D');
$this->addSql('DROP INDEX IDX_C2274AF45256794D ON specialist');
$this->addSql('ALTER TABLE specialist DROP affiliated_company_id, DROP is_affiliated');
}
}