migrations/Version20231113084737.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 Version20231113084737 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.         //ALTER TABLE
  19.         $this->addSql('ALTER TABLE email CHANGE parameters parameters LONGTEXT NOT NULL COLLATE `utf8mb4_bin` COMMENT \'(DC2Type:json)\'');
  20.         $this->addSql('ALTER TABLE `order`
  21.             CHANGE delivery_address_copy_emails delivery_address_copy_emails LONGTEXT NOT NULL COLLATE `utf8mb4_bin` COMMENT \'(DC2Type:json)\',
  22.             CHANGE delivery_address_blind_copy_emails delivery_address_blind_copy_emails LONGTEXT NOT NULL COLLATE `utf8mb4_bin` COMMENT \'(DC2Type:json)\',
  23.             CHANGE billing_address_copy_emails billing_address_copy_emails LONGTEXT NOT NULL COLLATE `utf8mb4_bin` COMMENT \'(DC2Type:json)\',
  24.             CHANGE billing_address_blind_copy_emails billing_address_blind_copy_emails LONGTEXT NOT NULL COLLATE `utf8mb4_bin` COMMENT \'(DC2Type:json)\',
  25.             CHANGE main_address_copy_emails main_address_copy_emails LONGTEXT NOT NULL COLLATE `utf8mb4_bin` COMMENT \'(DC2Type:json)\',
  26.             CHANGE main_address_blind_copy_emails main_address_blind_copy_emails LONGTEXT NOT NULL COLLATE `utf8mb4_bin` COMMENT \'(DC2Type:json)\'
  27.         ');
  28.         $this->addSql('ALTER TABLE point_transfer ADD comment VARCHAR(255) DEFAULT NULL');
  29.         $this->addSql('ALTER TABLE shop_product CHANGE to_edit to_edit TINYINT(1) DEFAULT 0 NOT NULL');
  30.         $this->addSql('ALTER TABLE supplier_product CHANGE shipping_costs shipping_costs INT DEFAULT 0 NOT NULL');
  31.         //FOREIGN KEY DROP
  32.         $this->addSql('ALTER TABLE shop_product DROP FOREIGN KEY FK_D07944872ADD6D8C');
  33.         $this->addSql('ALTER TABLE supplier_brand DROP FOREIGN KEY FK_C549FB722ADD6D8C');
  34.         $this->addSql('ALTER TABLE supplier_product DROP FOREIGN KEY FK_522F70B22ADD6D8C');
  35.         $this->addSql('ALTER TABLE supplier_taxonomy DROP FOREIGN KEY FK_709BD0BC2ADD6D8C');
  36.         //FOREIGN KEY ADD
  37.         $this->addSql('ALTER TABLE shop_product ADD CONSTRAINT FK_D07944872ADD6D8C FOREIGN KEY (supplier_id) REFERENCES company (id)');
  38.         $this->addSql('ALTER TABLE supplier_brand ADD CONSTRAINT FK_C549FB722ADD6D8C FOREIGN KEY (supplier_id) REFERENCES company (id)');
  39.         $this->addSql('ALTER TABLE supplier_product ADD CONSTRAINT FK_522F70B22ADD6D8C FOREIGN KEY (supplier_id) REFERENCES company (id)');
  40.         $this->addSql('ALTER TABLE supplier_taxonomy ADD CONSTRAINT FK_709BD0BC2ADD6D8C FOREIGN KEY (supplier_id) REFERENCES company (id)');
  41.         //DROP INDEX
  42.         $this->addSql('DROP INDEX `supplier_id reference` ON shop_product');
  43.         $this->addSql('DROP INDEX `supplier_id state` ON shop_product');
  44.         $this->addSql('DROP INDEX `name supplier_id` ON supplier_brand');
  45.         $this->addSql('DROP INDEX `new supplier_id` ON supplier_product');
  46.         $this->addSql('DROP INDEX `hash supplier_id` ON supplier_taxonomy');
  47.         //CREATE INDEX
  48.         $this->addSql('CREATE INDEX supplier_id_reference ON shop_product (supplier_id, `reference`)');
  49.         $this->addSql('CREATE INDEX supplier_id_state ON shop_product (supplier_id, state)');
  50.         $this->addSql('CREATE INDEX name_supplier_id ON supplier_brand (name, supplier_id)');
  51.         $this->addSql('CREATE INDEX new_supplier_id ON supplier_product (new, supplier_id)');
  52.         $this->addSql('CREATE INDEX hash_supplier_id ON supplier_taxonomy (hash, supplier_id)');
  53.     }
  54.     public function down(Schema $schema): void
  55.     {
  56.         // this down() migration is auto-generated, please modify it to your needs
  57.         //ALTER TABLE
  58.         $this->addSql('ALTER TABLE email CHANGE parameters parameters LONGTEXT NOT NULL COLLATE `utf8mb4_bin`');
  59.         $this->addSql('ALTER TABLE `order` CHANGE delivery_address_copy_emails delivery_address_copy_emails LONGTEXT NOT NULL COLLATE `utf8mb4_bin`, CHANGE delivery_address_blind_copy_emails delivery_address_blind_copy_emails LONGTEXT NOT NULL COLLATE `utf8mb4_bin`, CHANGE billing_address_copy_emails billing_address_copy_emails LONGTEXT NOT NULL COLLATE `utf8mb4_bin`, CHANGE billing_address_blind_copy_emails billing_address_blind_copy_emails LONGTEXT NOT NULL COLLATE `utf8mb4_bin`, CHANGE main_address_copy_emails main_address_copy_emails LONGTEXT NOT NULL COLLATE `utf8mb4_bin`, CHANGE main_address_blind_copy_emails main_address_blind_copy_emails LONGTEXT NOT NULL COLLATE `utf8mb4_bin`');
  60.         $this->addSql('ALTER TABLE `point_transfer` DROP comment');
  61.         $this->addSql('ALTER TABLE shop_product CHANGE to_edit to_edit TINYINT(1) DEFAULT FALSE NOT NULL');
  62.         $this->addSql('ALTER TABLE supplier_product CHANGE shipping_costs shipping_costs INT NOT NULL');
  63.         //FOREIGN KEY DROP
  64.         $this->addSql('ALTER TABLE `shop_product` DROP FOREIGN KEY FK_D07944872ADD6D8C');
  65.         $this->addSql('ALTER TABLE supplier_brand DROP FOREIGN KEY FK_C549FB722ADD6D8C');
  66.         $this->addSql('ALTER TABLE supplier_taxonomy DROP FOREIGN KEY FK_709BD0BC2ADD6D8C');
  67.         $this->addSql('ALTER TABLE `supplier_product` DROP FOREIGN KEY FK_522F70B22ADD6D8C');
  68.         //FOREIGN KEY ADD
  69.         $this->addSql('ALTER TABLE `shop_product` ADD CONSTRAINT FK_D07944872ADD6D8C FOREIGN KEY (supplier_id) REFERENCES company (id)');
  70.         $this->addSql('ALTER TABLE supplier_brand ADD CONSTRAINT FK_C549FB722ADD6D8C FOREIGN KEY (supplier_id) REFERENCES company (id)');
  71.         $this->addSql('ALTER TABLE supplier_taxonomy ADD CONSTRAINT FK_709BD0BC2ADD6D8C FOREIGN KEY (supplier_id) REFERENCES company (id)');
  72.         $this->addSql('ALTER TABLE `supplier_product` ADD CONSTRAINT FK_522F70B22ADD6D8C FOREIGN KEY (supplier_id) REFERENCES company (id)');
  73.         //DROP INDEX
  74.         $this->addSql('DROP INDEX supplier_id_reference ON `shop_product`');
  75.         $this->addSql('DROP INDEX supplier_id_state ON `shop_product`');
  76.         $this->addSql('DROP INDEX name_supplier_id ON supplier_brand');
  77.         $this->addSql('DROP INDEX hash_supplier_id ON supplier_taxonomy');
  78.         $this->addSql('DROP INDEX new_supplier_id ON `supplier_product`');
  79.         //CREATE INDEX
  80.         $this->addSql('CREATE INDEX `supplier_id reference` ON `shop_product` (supplier_id, reference)');
  81.         $this->addSql('CREATE INDEX `supplier_id state` ON `shop_product` (supplier_id, state)');
  82.         $this->addSql('CREATE INDEX `name supplier_id` ON supplier_brand (name, supplier_id)');
  83.         $this->addSql('CREATE INDEX `hash supplier_id` ON supplier_taxonomy (hash, supplier_id)');
  84.         $this->addSql('CREATE INDEX `new supplier_id` ON `supplier_product` (new, supplier_id)');
  85.     }
  86. }