migrations/Version20251014124912.php line 1

Open in your IDE?
  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 Version20251014124912 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('ALTER TABLE cart_detail ADD collection_id INT DEFAULT NULL, ADD emotion_id INT DEFAULT NULL');
            $this->addSql('ALTER TABLE cart_detail ADD CONSTRAINT FK_20821DCC514956FD FOREIGN KEY (collection_id) REFERENCES collection (id)');
            $this->addSql('ALTER TABLE cart_detail ADD CONSTRAINT FK_20821DCC1EE4A582 FOREIGN KEY (emotion_id) REFERENCES emotion (id)');
            $this->addSql('CREATE INDEX IDX_20821DCC514956FD ON cart_detail (collection_id)');
            $this->addSql('CREATE INDEX IDX_20821DCC1EE4A582 ON cart_detail (emotion_id)');
            $this->addSql('ALTER TABLE favorite ADD collection_id INT DEFAULT NULL, ADD emotion_id INT DEFAULT NULL');
            $this->addSql('ALTER TABLE favorite ADD CONSTRAINT FK_68C58ED9514956FD FOREIGN KEY (collection_id) REFERENCES collection (id)');
            $this->addSql('ALTER TABLE favorite ADD CONSTRAINT FK_68C58ED91EE4A582 FOREIGN KEY (emotion_id) REFERENCES emotion (id)');
            $this->addSql('CREATE INDEX IDX_68C58ED9514956FD ON favorite (collection_id)');
            $this->addSql('CREATE INDEX IDX_68C58ED91EE4A582 ON favorite (emotion_id)');
        }
    
        public function down(Schema $schema): void
        {
            // this down() migration is auto-generated, please modify it to your needs
            $this->addSql('ALTER TABLE cart_detail DROP FOREIGN KEY FK_20821DCC514956FD');
            $this->addSql('ALTER TABLE cart_detail DROP FOREIGN KEY FK_20821DCC1EE4A582');
            $this->addSql('DROP INDEX IDX_20821DCC514956FD ON cart_detail');
            $this->addSql('DROP INDEX IDX_20821DCC1EE4A582 ON cart_detail');
            $this->addSql('ALTER TABLE cart_detail DROP collection_id, DROP emotion_id');
            $this->addSql('ALTER TABLE favorite DROP FOREIGN KEY FK_68C58ED9514956FD');
            $this->addSql('ALTER TABLE favorite DROP FOREIGN KEY FK_68C58ED91EE4A582');
            $this->addSql('DROP INDEX IDX_68C58ED9514956FD ON favorite');
            $this->addSql('DROP INDEX IDX_68C58ED91EE4A582 ON favorite');
            $this->addSql('ALTER TABLE favorite DROP collection_id, DROP emotion_id');
        }
    }