vendor/pimcore/data-importer/src/Migrations/Version20220304130000.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. /**
  15.  * Pimcore
  16.  *
  17.  * This source file is available under two different licenses:
  18.  * - GNU General Public License version 3 (GPLv3)
  19.  * - Pimcore Commercial License (PCL)
  20.  * Full copyright and license information is available in
  21.  * LICENSE.md which is distributed with this source code.
  22.  *
  23.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  24.  *  @license    http://www.pimcore.org/license     GPLv3 and PCL
  25.  */
  26. namespace Pimcore\Bundle\DataImporterBundle\Migrations;
  27. use Doctrine\DBAL\Schema\Schema;
  28. use Pimcore\Bundle\DataImporterBundle\Queue\QueueService;
  29. use Pimcore\Migrations\BundleAwareMigration;
  30. class Version20220304130000 extends BundleAwareMigration
  31. {
  32.     public function up(Schema $schema): void
  33.     {
  34.         if ($schema->hasTable(QueueService::QUEUE_TABLE_NAME)) {
  35.             $queueTable $schema->getTable(QueueService::QUEUE_TABLE_NAME);
  36.             $queueTable->addColumn('dispatched''bigint', ['notnull' => false'default' => null]);
  37.             $queueTable->addColumn('workerId''string', ['notnull' => false'default' => null'length' => 13]);
  38.             $queueTable->addIndex(['executionType''workerId'], 'bundle_index_queue_executiontype_workerId');
  39.         }
  40.     }
  41.     public function down(Schema $schema): void
  42.     {
  43.         if ($schema->hasTable(QueueService::QUEUE_TABLE_NAME)) {
  44.             $queueTable $schema->getTable(QueueService::QUEUE_TABLE_NAME);
  45.             $queueTable->dropColumn('dispatched');
  46.             $queueTable->dropColumn('workerId');
  47.             $queueTable->dropIndex('bundle_index_queue_executiontype_workerId');
  48.         }
  49.     }
  50.     protected function getBundleName(): string
  51.     {
  52.         return 'PimcoreDataImporterBundle';
  53.     }
  54. }