migrations/Version20220517094016.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 Version20220517094016 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('CREATE TABLE product_shop_mode (id INT AUTO_INCREMENT NOT NULL, product_id INT DEFAULT NULL, shop_mode_id INT DEFAULT NULL, tax_id INT DEFAULT NULL, price DOUBLE PRECISION DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_3898175D4584665A (product_id), INDEX IDX_3898175D74D6C560 (shop_mode_id), INDEX IDX_3898175DB2A824D8 (tax_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE product_shop_mode ADD CONSTRAINT FK_3898175D4584665A FOREIGN KEY (product_id) REFERENCES product (id)');
  20.         $this->addSql('ALTER TABLE product_shop_mode ADD CONSTRAINT FK_3898175D74D6C560 FOREIGN KEY (shop_mode_id) REFERENCES shop_mode (id)');
  21.         $this->addSql('ALTER TABLE product_shop_mode ADD CONSTRAINT FK_3898175DB2A824D8 FOREIGN KEY (tax_id) REFERENCES tax (id)');
  22.         $this->addSql('ALTER TABLE product DROP price, DROP taxe');
  23.         $this->addSql('ALTER TABLE shop ADD currency_id INT DEFAULT NULL');
  24.         $this->addSql('ALTER TABLE shop ADD CONSTRAINT FK_AC6A4CA238248176 FOREIGN KEY (currency_id) REFERENCES currency (id)');
  25.         $this->addSql('CREATE INDEX IDX_AC6A4CA238248176 ON shop (currency_id)');
  26.         $this->addSql('ALTER TABLE shop_settings CHANGE time_slot_blocking_type time_slot_blocking_type ENUM(\'product\',\'order\')');
  27.         $this->addSql('ALTER TABLE tax ADD created_at DATETIME NOT NULL, ADD updated_at DATETIME NOT NULL, DROP create_at, DROP edited_at, CHANGE value value INT DEFAULT NULL');
  28.     }
  29.     public function down(Schema $schema): void
  30.     {
  31.         // this down() migration is auto-generated, please modify it to your needs
  32.         $this->addSql('DROP TABLE product_shop_mode');
  33.         $this->addSql('ALTER TABLE product ADD price DOUBLE PRECISION NOT NULL, ADD taxe DOUBLE PRECISION DEFAULT NULL');
  34.         $this->addSql('ALTER TABLE shop DROP FOREIGN KEY FK_AC6A4CA238248176');
  35.         $this->addSql('DROP INDEX IDX_AC6A4CA238248176 ON shop');
  36.         $this->addSql('ALTER TABLE shop DROP currency_id');
  37.         $this->addSql('ALTER TABLE shop_settings CHANGE time_slot_blocking_type time_slot_blocking_type VARCHAR(255) DEFAULT NULL');
  38.         $this->addSql('ALTER TABLE tax ADD create_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD edited_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', DROP created_at, DROP updated_at, CHANGE value value DOUBLE PRECISION NOT NULL');
  39.     }
  40. }