<?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 Version20240721172633 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 manga_content_source (manga_id INT NOT NULL, content_source_id INT NOT NULL, PRIMARY KEY(manga_id, content_source_id))');
        $this->addSql('CREATE INDEX IDX_2C40CB647B6461 ON manga_content_source (manga_id)');
        $this->addSql('CREATE INDEX IDX_2C40CB64A5DB5462 ON manga_content_source (content_source_id)');
        $this->addSql('ALTER TABLE manga_content_source ADD CONSTRAINT FK_2C40CB647B6461 FOREIGN KEY (manga_id) REFERENCES manga (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
        $this->addSql('ALTER TABLE manga_content_source ADD CONSTRAINT FK_2C40CB64A5DB5462 FOREIGN KEY (content_source_id) REFERENCES content_source (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('CREATE SCHEMA public');
        $this->addSql('ALTER TABLE manga_content_source DROP CONSTRAINT FK_2C40CB647B6461');
        $this->addSql('ALTER TABLE manga_content_source DROP CONSTRAINT FK_2C40CB64A5DB5462');
        $this->addSql('DROP TABLE manga_content_source');
    }
}
