migrations/Version20230524123051.php line 1
<?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 Version20230524123051 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 site_type_intervention (site_id INT NOT NULL, type_intervention_id INT NOT NULL, INDEX IDX_8ABA75C0F6BD1646 (site_id), INDEX IDX_8ABA75C0799AAC17 (type_intervention_id), PRIMARY KEY(site_id, type_intervention_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE type_intervention_site (type_intervention_id INT NOT NULL, site_id INT NOT NULL, INDEX IDX_DACD0DBD799AAC17 (type_intervention_id), INDEX IDX_DACD0DBDF6BD1646 (site_id), PRIMARY KEY(type_intervention_id, site_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE site_type_intervention ADD CONSTRAINT FK_8ABA75C0F6BD1646 FOREIGN KEY (site_id) REFERENCES site (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE site_type_intervention ADD CONSTRAINT FK_8ABA75C0799AAC17 FOREIGN KEY (type_intervention_id) REFERENCES type_intervention (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE type_intervention_site ADD CONSTRAINT FK_DACD0DBD799AAC17 FOREIGN KEY (type_intervention_id) REFERENCES type_intervention (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE type_intervention_site ADD CONSTRAINT FK_DACD0DBDF6BD1646 FOREIGN KEY (site_id) REFERENCES site (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE site_type_intervention DROP FOREIGN KEY FK_8ABA75C0F6BD1646');
$this->addSql('ALTER TABLE site_type_intervention DROP FOREIGN KEY FK_8ABA75C0799AAC17');
$this->addSql('ALTER TABLE type_intervention_site DROP FOREIGN KEY FK_DACD0DBD799AAC17');
$this->addSql('ALTER TABLE type_intervention_site DROP FOREIGN KEY FK_DACD0DBDF6BD1646');
$this->addSql('DROP TABLE site_type_intervention');
$this->addSql('DROP TABLE type_intervention_site');
}
}