Deprecated: Constant E_STRICT is deprecated in /data/web/apps/test2-bridge.kwalitaria.bluebirdday.io/releases/1/vendor/symfony/error-handler/ErrorHandler.php on line 58

Deprecated: Constant E_STRICT is deprecated in /data/web/apps/test2-bridge.kwalitaria.bluebirdday.io/releases/1/vendor/symfony/error-handler/ErrorHandler.php on line 76
Symfony Profiler

migrations/Version20220222102656.php line 1

  1. <?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 Version20220222102656 extends AbstractMigration
    {
        public function getDescription(): string
        {
            return 'Renamed vat to assortment_product_vat';
        }
    
        public function up(Schema $schema): void
        {
            $this->addSql('DROP TABLE IF EXISTS assortment_product_vat');
            $this->addSql('CREATE TABLE assortment_product_vat (id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', product_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', percentage NUMERIC(10, 0) NOT NULL, country_code VARCHAR(255) NOT NULL, updated_at DATETIME DEFAULT NULL, created_at DATETIME DEFAULT NULL, INDEX IDX_366AC54584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
            $this->addSql('ALTER TABLE assortment_product_vat ADD CONSTRAINT FK_366AC54584665A FOREIGN KEY (product_id) REFERENCES assortment_product (id) ON DELETE CASCADE');
    
            // We renamed vat to assortment_product_vat. Now the new table exists, first fill it in before we drop the old table.
            $this->addSql('INSERT INTO assortment_product_vat (id, product_id, percentage, country_code, updated_at, created_at)
                SELECT id, product_id, percentage, country_code, updated_at, created_at FROM vat');
            $this->addSql('DROP TABLE vat');
    
            // Add missing cascade for assortment_extra_set_product -> assortment_extra_set.
            $this->addSql('ALTER TABLE assortment_extra_set_product DROP FOREIGN KEY FK_3E48911AC6D735B0');
            $this->addSql('ALTER TABLE assortment_extra_set_product ADD CONSTRAINT FK_3E48911AC6D735B0 FOREIGN KEY (extra_set_id) REFERENCES assortment_extra_set (id) ON DELETE CASCADE');
    
            // Move some columns.
            $this->addSql("ALTER TABLE usp MODIFY drupal_id CHAR(36) NULL COMMENT '(DC2Type:uuid)' AFTER id");
            $this->addSql("ALTER TABLE card MODIFY drupal_id CHAR(36) NULL COMMENT '(DC2Type:uuid)' AFTER id");
        }
    
        public function down(Schema $schema): void
        {
            $this->addSql('CREATE TABLE vat (id CHAR(36) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', product_id CHAR(36) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci` COMMENT \'(DC2Type:uuid)\', percentage NUMERIC(10, 0) NOT NULL, country_code VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, updated_at DATETIME DEFAULT NULL, created_at DATETIME DEFAULT NULL, INDEX IDX_84B322334584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
            $this->addSql('ALTER TABLE vat ADD CONSTRAINT FK_84B322334584665A FOREIGN KEY (product_id) REFERENCES assortment_product (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
            // Switch back data from new assortment_product_vat table back to vat.
            $this->addSql('INSERT INTO vat (id, product_id, percentage, country_code, updated_at, created_at)
                SELECT id, product_id, percentage, country_code, updated_at, created_at FROM assortment_product_vat');
            $this->addSql('DROP TABLE assortment_product_vat');
            $this->addSql('ALTER TABLE assortment_extra_set_product DROP FOREIGN KEY FK_3E48911AC6D735B0');
            $this->addSql('ALTER TABLE assortment_extra_set_product ADD CONSTRAINT FK_3E48911AC6D735B0 FOREIGN KEY (extra_set_id) REFERENCES assortment_extra_set (id) ON UPDATE NO ACTION ON DELETE NO ACTION');
        }
    
        public function isTransactional(): bool
        {
            return false;
        }
    }