vendor/pimcore/data-importer/src/Migrations/Version20211110174732.php line 1

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Commercial License (PCL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  *  @license    http://www.pimcore.org/license     GPLv3 and PCL
  13.  */
  14. namespace Pimcore\Bundle\DataImporterBundle\Migrations;
  15. use Doctrine\DBAL\Schema\Schema;
  16. use Pimcore\Migrations\BundleAwareMigration;
  17. class Version20211110174732 extends BundleAwareMigration
  18. {
  19.     protected const DELTA_CACHE_TABLE 'bundle_data_hub_data_importer_delta_cache';
  20.     protected const LAST_CRON_TABLE 'bundle_data_hub_data_importer_last_cron_execution';
  21.     protected const IMPORTER_QUEUE_TABLE 'bundle_data_hub_data_importer_queue';
  22.     protected function getBundleName(): string
  23.     {
  24.         return 'PimcoreDataImporterBundle';
  25.     }
  26.     /**
  27.      * @param Schema $schema
  28.      */
  29.     public function up(Schema $schema): void
  30.     {
  31.         if ($schema->hasTable(self::DELTA_CACHE_TABLE)) {
  32.             $this->addSql(sprintf('ALTER TABLE `%s` MODIFY `configName` VARCHAR(80)'self::DELTA_CACHE_TABLE));
  33.         }
  34.         if ($schema->hasTable(self::LAST_CRON_TABLE)) {
  35.             $this->addSql(sprintf('ALTER TABLE `%s` MODIFY `configName` VARCHAR(80)'self::LAST_CRON_TABLE));
  36.         }
  37.         if ($schema->hasTable(self::IMPORTER_QUEUE_TABLE)) {
  38.             $this->addSql(sprintf('ALTER TABLE `%s` MODIFY `configName` VARCHAR(80)'self::IMPORTER_QUEUE_TABLE));
  39.         }
  40.     }
  41.     /**
  42.      * @param Schema $schema
  43.      */
  44.     public function down(Schema $schema): void
  45.     {
  46.         if ($schema->hasTable(self::DELTA_CACHE_TABLE)) {
  47.             $this->addSql(sprintf('ALTER TABLE `%s` MODIFY `configName` VARCHAR(50)'self::DELTA_CACHE_TABLE));
  48.         }
  49.         if ($schema->hasTable(self::LAST_CRON_TABLE)) {
  50.             $this->addSql(sprintf('ALTER TABLE `%s` MODIFY `configName` VARCHAR(50)'self::LAST_CRON_TABLE));
  51.         }
  52.         if ($schema->hasTable(self::IMPORTER_QUEUE_TABLE)) {
  53.             $this->addSql(sprintf('ALTER TABLE `%s` MODIFY `configName` VARCHAR(50)'self::IMPORTER_QUEUE_TABLE));
  54.         }
  55.     }
  56. }