Skip to content

Commit ec80358

Browse files
authored
fix classname column too short (#1868)
1 parent 1ee1166 commit ec80358

5 files changed

Lines changed: 64 additions & 4 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Upgrade Information
2+
3+
The following steps are necessary during updating to newer versions.
4+
5+
## Upgrade to 2025.4.5
6+
- [Grid Configuration] Fixed: Changed the length of `classId` column in `bundle_studio_grid_configurations` and `bundle_studio_grid_configuration_favorites` tables from 10 to 50 characters to support longer class IDs.
7+
8+
### Migration execution required
9+
After upgrading, please execute the migration to apply the necessary database changes.
10+
11+
> **Note:** Grid configurations that were previously saved with a class ID longer than 10 characters have a truncated `classId` value in the database and will not be recovered by this migration. These configurations need to be deleted and re-saved after upgrading.

src/Entity/Grid/GridConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class GridConfiguration
3737
#[ORM\Column(type: 'integer', nullable: true, options: ['unsigned' => true])]
3838
private ?int $assetFolderId = null;
3939

40-
#[ORM\Column(type: 'string', nullable: true, length: 10)]
40+
#[ORM\Column(type: 'string', length: 50, nullable: true)]
4141
private ?string $classId = null;
4242

4343
#[ORM\Column(type: 'integer', nullable: true, options: ['unsigned' => true])]

src/Entity/Grid/GridConfigurationFavorite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class GridConfigurationFavorite
3737
#[ORM\Id]
3838
private int $folder;
3939

40-
#[ORM\Column(type: 'string', nullable: true, length: 10)]
40+
#[ORM\Column(type: 'string', length: 50, nullable: true)]
4141
private ?string $classId = null;
4242

4343
public function getUser(): int

src/Installer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function createGridConfigurationFavoritesTable(Schema $schema): void
184184

185185
$table->addColumn('classId', 'string', [
186186
'notnull' => false,
187-
'length' => 10,
187+
'length' => 50,
188188
]);
189189

190190
$table->addForeignKeyConstraint(
@@ -269,7 +269,7 @@ private function createGridConfigurationTable(Schema $schema): void
269269
'unsigned' => true,
270270
]);
271271

272-
$table->addColumn('classId', 'string', ['notnull' => false, 'length' => 10]);
272+
$table->addColumn('classId', 'string', ['notnull' => false, 'length' => 50]);
273273

274274
$table->addColumn(
275275
'owner',
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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

Comments
 (0)