<?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 Version20220721123306 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 job_ad_options (jobad_id INT NOT NULL, option_id INT NOT NULL, INDEX IDX_7708831E95DDD3CC (jobad_id), INDEX IDX_7708831EA7C41D6F (option_id), PRIMARY KEY(jobad_id, option_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE job_ad_options ADD CONSTRAINT FK_7708831E95DDD3CC FOREIGN KEY (jobad_id) REFERENCES job_ad (id)');
$this->addSql('ALTER TABLE job_ad_options ADD CONSTRAINT FK_7708831EA7C41D6F FOREIGN KEY (option_id) REFERENCES job_options (id)');
$this->addSql('ALTER TABLE job_options DROP FOREIGN KEY FK_4ADA4D1C4E6868E6');
$this->addSql('DROP INDEX IDX_4ADA4D1C4E6868E6 ON job_options');
$this->addSql('ALTER TABLE job_options DROP job_ad_id');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE job_ad_options');
$this->addSql('ALTER TABLE job_options ADD job_ad_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE job_options ADD CONSTRAINT FK_4ADA4D1C4E6868E6 FOREIGN KEY (job_ad_id) REFERENCES job_ad (id)');
$this->addSql('CREATE INDEX IDX_4ADA4D1C4E6868E6 ON job_options (job_ad_id)');
}
}