migrations/Version20250912110132.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20250912110132 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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');
  19.         $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');
  20.         $this->addSql('ALTER TABLE stash_collection ADD CONSTRAINT FK_5A06B334922726E9 FOREIGN KEY (cover_id) REFERENCES document (id)');
  21.         $this->addSql('ALTER TABLE stash_collection ADD CONSTRAINT FK_5A06B3347E3C61F9 FOREIGN KEY (owner_id) REFERENCES access (id)');
  22.         $this->addSql('ALTER TABLE stash_item ADD CONSTRAINT FK_F2C18188922726E9 FOREIGN KEY (cover_id) REFERENCES document (id)');
  23.         $this->addSql('ALTER TABLE stash_item ADD CONSTRAINT FK_F2C18188514956FD FOREIGN KEY (collection_id) REFERENCES stash_collection (id)');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('ALTER TABLE stash_item DROP FOREIGN KEY FK_F2C18188514956FD');
  29.         $this->addSql('DROP TABLE stash_collection');
  30.         $this->addSql('DROP TABLE stash_item');
  31.     }
  32. }