mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Missing default length on ID field type string #7348
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bigfoot90 on GitHub (Mar 19, 2024).
BC Break Report
Summary
Migrating from
2.19.2to3.1.0I'm getting an error runningschema:diffError:
Previous behavior
Mapping before migration:
Current behavior
Actual mapping:
Expected behavior
Be able to migrate schema without errors and don't see changes on column
namelength.How to reproduce
Create an entity with Id type string.
Value
255was the default length for type string in ORM 2.19@herndlm commented on GitHub (May 24, 2024):
I'm not sure if you're saying that the issue is that you need to add
lengthnow, which is expected I guess. But I had a similar problem and it turned out that an outdated cache was the reason. We have an app with a custom bootstrappedEntityManagerwhich uses an instance ofORMSetupwhere we pass a SymfonyFilesystemAdapter. Long story short, I had to just clear that directory and it started working.@tarlepp commented on GitHub (Nov 9, 2024):
I'm also facing this same issue.
Tried to add
length: 255toColumnattribute but after that validating schema gives me[ERROR] The database schema is not in sync with the current mapping file.error.So next I tried to run
doctrine:migrations:diffcommand and that gives meCannot modify readonly property Doctrine\DBAL\Schema\Index::$optionserror.Also I nuked cache after each step, and that didn't solve this issue.
Anyone has idea how to solve this issue?
@dimadeush commented on GitHub (Jun 29, 2025):
Hello
Using the latest orm 3.4 and dbal 4.2 I have another issue with the same readonly property while executing bin/console doctrine:migrations:diff:
Anyone has idea how to solve this issue?
p.s. @tarlepp I added length and it seems now it is ok (
a90042a527/src/Role/Domain/Entity/Role.php (L66)). But maybe we have different cases, not sure.....@beberlei maybe you can help with this issue, please
@dimadeush commented on GitHub (Jun 29, 2025):
@tarlepp it seems the issue inside friendsofphp/proxy-manager-lts or symfony/proxy-manager-bridge:
@greg0ire commented on GitHub (Jun 29, 2025):
@dimadeush then maybe you should try updating to a recent
doctrine/migrationversion? It does not rely on those libraries since https://github.com/doctrine/migrations/pull/1273, which was released in 3.6.0@dimadeush commented on GitHub (Jun 30, 2025):
@greg0ire we are using the latest version of doctrine/migration. We have additional services that are using mentioned above bundle, f.e. like the next https://medium.marco.zone/add-the-symfony-stopwatch-to-services-without-changing-them-e52266df0df1.
@dimadeush commented on GitHub (Jun 30, 2025):
@tarlepp Maybe the best way to solve this issue just put
Doctrine\DBAL\Schema\Indexinto ignore for the StopwatchDecorator - https://github.com/systemsdk/docker-symfony-api/blob/3.6.x/src/General/Application/Decorator/StopwatchDecorator.php#L44@greg0ire now migrations:diff is working properly with the latest orm 3.4 and dbal 4.2, thanks.
@Adi-18 commented on GitHub (Jan 10, 2026):
Same problem
Fielddefinition:
Link did not help because of "404 - page not found"
@dimadeush commented on GitHub (Jan 10, 2026):
New link is - https://github.com/systemsdk/docker-symfony-api/blob/master/src/General/Application/Decorator/StopwatchDecorator.php#L45
If you have something like that - please try to use.