migrations/Version20200125183212.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 Version20200125183212 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->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  19.         $this->addSql('ALTER TABLE cart_item DROP FOREIGN KEY FK_F0FE2527785ED629');
  20.         $this->addSql('ALTER TABLE cart_item DROP FOREIGN KEY FK_F0FE2527C3F36F5F');
  21.         $this->addSql('DROP INDEX IDX_F0FE2527785ED629 ON cart_item');
  22.         $this->addSql('DROP INDEX IDX_F0FE2527C3F36F5F ON cart_item');
  23.         $this->addSql('ALTER TABLE cart_item ADD cart_id INT DEFAULT NULL, ADD product_id INT DEFAULT NULL, DROP unitPrice, DROP idCart, DROP idProduct');
  24.         $this->addSql('ALTER TABLE cart_item ADD CONSTRAINT FK_F0FE25271AD5CDBF FOREIGN KEY (cart_id) REFERENCES cart (id)');
  25.         $this->addSql('ALTER TABLE cart_item ADD CONSTRAINT FK_F0FE25274584665A FOREIGN KEY (product_id) REFERENCES product (id)');
  26.         $this->addSql('CREATE INDEX IDX_F0FE25271AD5CDBF ON cart_item (cart_id)');
  27.         $this->addSql('CREATE INDEX IDX_F0FE25274584665A ON cart_item (product_id)');
  28.     }
  29.     public function down(Schema $schema) : void
  30.     {
  31.         // this down() migration is auto-generated, please modify it to your needs
  32.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  33.         $this->addSql('ALTER TABLE cart_item DROP FOREIGN KEY FK_F0FE25271AD5CDBF');
  34.         $this->addSql('ALTER TABLE cart_item DROP FOREIGN KEY FK_F0FE25274584665A');
  35.         $this->addSql('DROP INDEX IDX_F0FE25271AD5CDBF ON cart_item');
  36.         $this->addSql('DROP INDEX IDX_F0FE25274584665A ON cart_item');
  37.         $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');
  38.         $this->addSql('ALTER TABLE cart_item ADD CONSTRAINT FK_F0FE2527785ED629 FOREIGN KEY (idCart) REFERENCES cart (id)');
  39.         $this->addSql('ALTER TABLE cart_item ADD CONSTRAINT FK_F0FE2527C3F36F5F FOREIGN KEY (idProduct) REFERENCES product (id)');
  40.         $this->addSql('CREATE INDEX IDX_F0FE2527785ED629 ON cart_item (idCart)');
  41.         $this->addSql('CREATE INDEX IDX_F0FE2527C3F36F5F ON cart_item (idProduct)');
  42.     }
  43. }