migrations/Version20230521155054.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 Version20230521155054 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 image_gallery_content_resource (image_gallery_content_id INT NOT NULL, resource_id INT NOT NULL, PRIMARY KEY(image_gallery_content_id, resource_id))');
$this->addSql('CREATE INDEX IDX_E72ABB197E614D42 ON image_gallery_content_resource (image_gallery_content_id)');
$this->addSql('CREATE INDEX IDX_E72ABB1989329D25 ON image_gallery_content_resource (resource_id)');
$this->addSql('ALTER TABLE image_gallery_content_resource ADD CONSTRAINT FK_E72ABB197E614D42 FOREIGN KEY (image_gallery_content_id) REFERENCES image_gallery_content (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE image_gallery_content_resource ADD CONSTRAINT FK_E72ABB1989329D25 FOREIGN KEY (resource_id) REFERENCES resource (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE image_gallery_content_image_content DROP CONSTRAINT fk_bab62da17e614d42');
$this->addSql('ALTER TABLE image_gallery_content_image_content DROP CONSTRAINT fk_bab62da1e87eb4db');
$this->addSql('DROP TABLE image_gallery_content_image_content');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE image_gallery_content_image_content (image_gallery_content_id INT NOT NULL, image_content_id INT NOT NULL, PRIMARY KEY(image_gallery_content_id, image_content_id))');
$this->addSql('CREATE INDEX idx_bab62da1e87eb4db ON image_gallery_content_image_content (image_content_id)');
$this->addSql('CREATE INDEX idx_bab62da17e614d42 ON image_gallery_content_image_content (image_gallery_content_id)');
$this->addSql('ALTER TABLE image_gallery_content_image_content ADD CONSTRAINT fk_bab62da17e614d42 FOREIGN KEY (image_gallery_content_id) REFERENCES image_gallery_content (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE image_gallery_content_image_content ADD CONSTRAINT fk_bab62da1e87eb4db FOREIGN KEY (image_content_id) REFERENCES image_content (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE image_gallery_content_resource DROP CONSTRAINT FK_E72ABB197E614D42');
$this->addSql('ALTER TABLE image_gallery_content_resource DROP CONSTRAINT FK_E72ABB1989329D25');
$this->addSql('DROP TABLE image_gallery_content_resource');
}
}