migrations/Version20210705140434.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 Version20210705140434 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('ALTER TABLE product ADD type VARCHAR(100) NOT NULL');
  19.         $this->addSql('UPDATE product SET `type`="product"');
  20.         $this->connection->insert('productCategories', [
  21.             'name' => 'Envios',
  22.             'display' => 0
  23.         ]);
  24.         $id $this->connection->lastInsertId();
  25.         $this->addSql('INSERT INTO product(`name`, `type`, publicSale, active, base_price, price, tax, idCategory, recommended, isDeleted, is_wholesaler, description, presentation) VALUES
  26.             ("Envio Zona A", "shipping", 0, 1, 123.9669, 150, 21.0, ' $id ', 0, 0, 0, "", ""),
  27.             ("Envio Zona B", "shipping", 0, 1, 148.7603, 180, 21.0, ' $id ', 0, 0, 0, "", ""),
  28.             ("Envio Zona C", "shipping", 0, 1, 206.6116, 250, 21.0, ' $id ', 0, 0, 0, "", "")
  29.         ');
  30.     }
  31.     public function down(Schema $schema): void
  32.     {
  33.         // this down() migration is auto-generated, please modify it to your needs
  34.         $this->addSql('ALTER TABLE product DROP type');
  35.     }
  36.     public function isTransactional(): bool
  37.     {
  38.         return false;
  39.     }
  40. }