<?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 Version20250912110132 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 stash_collection (id INT AUTO_INCREMENT NOT NULL, cover_id INT DEFAULT NULL, owner_id INT NOT NULL, creation_date DATETIME DEFAULT NULL, name VARCHAR(255) NOT NULL, info LONGTEXT DEFAULT NULL, UNIQUE INDEX UNIQ_5A06B334922726E9 (cover_id), INDEX IDX_5A06B3347E3C61F9 (owner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE stash_item (id INT AUTO_INCREMENT NOT NULL, cover_id INT DEFAULT NULL, collection_id INT NOT NULL, creation_date DATETIME DEFAULT NULL, title VARCHAR(255) NOT NULL, info LONGTEXT DEFAULT NULL, UNIQUE INDEX UNIQ_F2C18188922726E9 (cover_id), INDEX IDX_F2C18188514956FD (collection_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE stash_collection ADD CONSTRAINT FK_5A06B334922726E9 FOREIGN KEY (cover_id) REFERENCES document (id)');
$this->addSql('ALTER TABLE stash_collection ADD CONSTRAINT FK_5A06B3347E3C61F9 FOREIGN KEY (owner_id) REFERENCES access (id)');
$this->addSql('ALTER TABLE stash_item ADD CONSTRAINT FK_F2C18188922726E9 FOREIGN KEY (cover_id) REFERENCES document (id)');
$this->addSql('ALTER TABLE stash_item ADD CONSTRAINT FK_F2C18188514956FD FOREIGN KEY (collection_id) REFERENCES stash_collection (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE stash_item DROP FOREIGN KEY FK_F2C18188514956FD');
$this->addSql('DROP TABLE stash_collection');
$this->addSql('DROP TABLE stash_item');
}
}