migrations/Version20221109101250.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 Version20221109101250 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 cart_detail (id INT AUTO_INCREMENT NOT NULL, cart_id INT NOT NULL, frame_id INT NOT NULL, quantity INT NOT NULL, INDEX IDX_20821DCC1AD5CDBF (cart_id), INDEX IDX_20821DCC3FA3C347 (frame_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $this->addSql('ALTER TABLE cart_detail ADD CONSTRAINT FK_20821DCC1AD5CDBF FOREIGN KEY (cart_id) REFERENCES cart (id)');
            $this->addSql('ALTER TABLE cart_detail ADD CONSTRAINT FK_20821DCC3FA3C347 FOREIGN KEY (frame_id) REFERENCES frame (id)');
            $this->addSql('DROP TABLE cart_frame');
            $this->addSql('ALTER TABLE cart ADD created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD deleted_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\'');
        }
    
        public function down(Schema $schema): void
        {
            // this down() migration is auto-generated, please modify it to your needs
            $this->addSql('CREATE TABLE cart_frame (cart_id INT NOT NULL, frame_id INT NOT NULL, INDEX IDX_EA1251C51AD5CDBF (cart_id), INDEX IDX_EA1251C53FA3C347 (frame_id), PRIMARY KEY(cart_id, frame_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
            $this->addSql('ALTER TABLE cart_frame ADD CONSTRAINT FK_EA1251C53FA3C347 FOREIGN KEY (frame_id) REFERENCES frame (id) ON DELETE CASCADE');
            $this->addSql('ALTER TABLE cart_frame ADD CONSTRAINT FK_EA1251C51AD5CDBF FOREIGN KEY (cart_id) REFERENCES cart (id) ON DELETE CASCADE');
            $this->addSql('DROP TABLE cart_detail');
            $this->addSql('ALTER TABLE cart DROP created_at, DROP updated_at, DROP deleted_at');
        }
    }