<?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 Version20220228202936 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 publications_authors (publication_id INT NOT NULL, author_id INT NOT NULL, INDEX IDX_B1E64FCA38B217A7 (publication_id), INDEX IDX_B1E64FCAF675F31B (author_id), PRIMARY KEY(publication_id, author_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE publications_keywords (publication_id INT NOT NULL, keyword_id INT NOT NULL, INDEX IDX_CDBD15F738B217A7 (publication_id), INDEX IDX_CDBD15F7115D4552 (keyword_id), PRIMARY KEY(publication_id, keyword_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE publications_authors ADD CONSTRAINT FK_B1E64FCA38B217A7 FOREIGN KEY (publication_id) REFERENCES publication (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE publications_authors ADD CONSTRAINT FK_B1E64FCAF675F31B FOREIGN KEY (author_id) REFERENCES author (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE publications_keywords ADD CONSTRAINT FK_CDBD15F738B217A7 FOREIGN KEY (publication_id) REFERENCES publication (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE publications_keywords ADD CONSTRAINT FK_CDBD15F7115D4552 FOREIGN KEY (keyword_id) REFERENCES keyword (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE publications_authors');
$this->addSql('DROP TABLE publications_keywords');
}
}