|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +/** |
| 6 | + * This source file is available under the terms of the |
| 7 | + * Pimcore Open Core License (POCL) |
| 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 (https://www.pimcore.com) |
| 12 | + * @license Pimcore Open Core License (POCL) |
| 13 | + */ |
| 14 | + |
| 15 | +namespace Pimcore\Bundle\StudioBackendBundle\Migrations; |
| 16 | + |
| 17 | +use Doctrine\DBAL\Schema\Schema; |
| 18 | +use Doctrine\Migrations\AbstractMigration; |
| 19 | +use Pimcore\Bundle\StudioBackendBundle\Entity\Grid\GridConfiguration; |
| 20 | +use Pimcore\Bundle\StudioBackendBundle\Entity\Grid\GridConfigurationFavorite; |
| 21 | + |
| 22 | +/** |
| 23 | + * @internal |
| 24 | + */ |
| 25 | +final class Version20260601120000 extends AbstractMigration |
| 26 | +{ |
| 27 | + public function getDescription(): string |
| 28 | + { |
| 29 | + return 'Increase classId column length from 10 to 50 '. |
| 30 | + 'in grid configuration and grid configuration favorite tables'; |
| 31 | + } |
| 32 | + |
| 33 | + public function up(Schema $schema): void |
| 34 | + { |
| 35 | + $this->increaseClassIdLength($schema, GridConfiguration::TABLE_NAME); |
| 36 | + $this->increaseClassIdLength($schema, GridConfigurationFavorite::TABLE_NAME); |
| 37 | + } |
| 38 | + |
| 39 | + private function increaseClassIdLength(Schema $schema, string $tableName): void |
| 40 | + { |
| 41 | + if (!$schema->hasTable($tableName)) { |
| 42 | + return; |
| 43 | + } |
| 44 | + |
| 45 | + $table = $schema->getTable($tableName); |
| 46 | + $column = $table->getColumn('classId'); |
| 47 | + $column->setLength(50); |
| 48 | + } |
| 49 | +} |
0 commit comments