<?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 Version20200125183212 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE cart_item DROP FOREIGN KEY FK_F0FE2527785ED629');
$this->addSql('ALTER TABLE cart_item DROP FOREIGN KEY FK_F0FE2527C3F36F5F');
$this->addSql('DROP INDEX IDX_F0FE2527785ED629 ON cart_item');
$this->addSql('DROP INDEX IDX_F0FE2527C3F36F5F ON cart_item');
$this->addSql('ALTER TABLE cart_item ADD cart_id INT DEFAULT NULL, ADD product_id INT DEFAULT NULL, DROP unitPrice, DROP idCart, DROP idProduct');
$this->addSql('ALTER TABLE cart_item ADD CONSTRAINT FK_F0FE25271AD5CDBF FOREIGN KEY (cart_id) REFERENCES cart (id)');
$this->addSql('ALTER TABLE cart_item ADD CONSTRAINT FK_F0FE25274584665A FOREIGN KEY (product_id) REFERENCES product (id)');
$this->addSql('CREATE INDEX IDX_F0FE25271AD5CDBF ON cart_item (cart_id)');
$this->addSql('CREATE INDEX IDX_F0FE25274584665A ON cart_item (product_id)');
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql('ALTER TABLE cart_item DROP FOREIGN KEY FK_F0FE25271AD5CDBF');
$this->addSql('ALTER TABLE cart_item DROP FOREIGN KEY FK_F0FE25274584665A');
$this->addSql('DROP INDEX IDX_F0FE25271AD5CDBF ON cart_item');
$this->addSql('DROP INDEX IDX_F0FE25274584665A ON cart_item');
$this->addSql('ALTER TABLE cart_item ADD unitPrice DOUBLE PRECISION NOT NULL, ADD idCart INT DEFAULT NULL, ADD idProduct INT DEFAULT NULL, DROP cart_id, DROP product_id');
$this->addSql('ALTER TABLE cart_item ADD CONSTRAINT FK_F0FE2527785ED629 FOREIGN KEY (idCart) REFERENCES cart (id)');
$this->addSql('ALTER TABLE cart_item ADD CONSTRAINT FK_F0FE2527C3F36F5F FOREIGN KEY (idProduct) REFERENCES product (id)');
$this->addSql('CREATE INDEX IDX_F0FE2527785ED629 ON cart_item (idCart)');
$this->addSql('CREATE INDEX IDX_F0FE2527C3F36F5F ON cart_item (idProduct)');
}
}