<?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 Version20251121130847 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 timecapsule_collection (id INT AUTO_INCREMENT NOT NULL, owner_id INT NOT NULL, cover_id INT DEFAULT NULL, tag_id INT DEFAULT NULL, creation_date DATETIME NOT NULL, name VARCHAR(255) NOT NULL, info LONGTEXT DEFAULT NULL, INDEX IDX_8540D1D27E3C61F9 (owner_id), UNIQUE INDEX UNIQ_8540D1D2922726E9 (cover_id), INDEX IDX_8540D1D2BAD26311 (tag_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE timecapsule_item (id INT AUTO_INCREMENT NOT NULL, owner_id INT NOT NULL, image_id INT DEFAULT NULL, creation_date DATETIME NOT NULL, info LONGTEXT DEFAULT NULL, INDEX IDX_7E2978647E3C61F9 (owner_id), UNIQUE INDEX UNIQ_7E2978643DA5256D (image_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE timecapsule_item_tag (item_id INT NOT NULL, tag_id INT NOT NULL, INDEX IDX_53BF3415126F525E (item_id), INDEX IDX_53BF3415BAD26311 (tag_id), PRIMARY KEY(item_id, tag_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE timecapsule_tag (id INT AUTO_INCREMENT NOT NULL, owner_id INT NOT NULL, value VARCHAR(255) NOT NULL, INDEX IDX_5A2B1E5D7E3C61F9 (owner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE timecapsule_collection ADD CONSTRAINT FK_8540D1D27E3C61F9 FOREIGN KEY (owner_id) REFERENCES access (id)');
$this->addSql('ALTER TABLE timecapsule_collection ADD CONSTRAINT FK_8540D1D2922726E9 FOREIGN KEY (cover_id) REFERENCES document (id)');
$this->addSql('ALTER TABLE timecapsule_collection ADD CONSTRAINT FK_8540D1D2BAD26311 FOREIGN KEY (tag_id) REFERENCES timecapsule_tag (id)');
$this->addSql('ALTER TABLE timecapsule_item ADD CONSTRAINT FK_7E2978647E3C61F9 FOREIGN KEY (owner_id) REFERENCES access (id)');
$this->addSql('ALTER TABLE timecapsule_item ADD CONSTRAINT FK_7E2978643DA5256D FOREIGN KEY (image_id) REFERENCES document (id)');
$this->addSql('ALTER TABLE timecapsule_item_tag ADD CONSTRAINT FK_53BF3415126F525E FOREIGN KEY (item_id) REFERENCES timecapsule_item (id)');
$this->addSql('ALTER TABLE timecapsule_item_tag ADD CONSTRAINT FK_53BF3415BAD26311 FOREIGN KEY (tag_id) REFERENCES timecapsule_tag (id)');
$this->addSql('ALTER TABLE timecapsule_tag ADD CONSTRAINT FK_5A2B1E5D7E3C61F9 FOREIGN KEY (owner_id) REFERENCES access (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE timecapsule_item_tag DROP FOREIGN KEY FK_53BF3415126F525E');
$this->addSql('ALTER TABLE timecapsule_collection DROP FOREIGN KEY FK_8540D1D2BAD26311');
$this->addSql('ALTER TABLE timecapsule_item_tag DROP FOREIGN KEY FK_53BF3415BAD26311');
$this->addSql('DROP TABLE timecapsule_collection');
$this->addSql('DROP TABLE timecapsule_item');
$this->addSql('DROP TABLE timecapsule_item_tag');
$this->addSql('DROP TABLE timecapsule_tag');
}
}