2.11.1 breaks db change detection for enum types #6927

Closed
opened 2026-01-22 15:41:31 +01:00 by admin · 2 comments
Owner

Originally created by @bobvandevijver on GitHub (Feb 8, 2022).

Bug Report

Q A
BC Break yes
Version 2.11.1

Summary

With 2.11.1 the database is reported as out of sync for enum based properties, while this does not happen with 2.11.0.

Current behavior

The database schema is being reported as not being in sync.

How to reproduce

Consider the following property:

class Documents {
  #[ORM\Column(length: 14, enumType: DocumentType::class)]
  private DocumentType $type = DocumentType::GENERIC;
}

with the enum being a string backed enum:

enum InstituteDocumentType: string
{
  case GENERIC   = 'generic';
  case PROCEDURE = 'procedure';
}

See the following console output:

bobvandevijver@webdev81:/var/www/project$ bin/console doctrine:schema:update --dump-sql

 The following SQL statements will be executed:

     ALTER TABLE documents CHANGE type type VARCHAR(14) NOT NULL;

bobvandevijver@webdev81:/var/www/project$ bin/console doctrine:schema:update --force

 Updating database schema...

     7 queries were executed

 [OK] Database schema updated successfully!

bobvandevijver@webdev81:/var/www/project$ bin/console doctrine:schema:update --dump-sql

 The following SQL statements will be executed:

     ALTER TABLE documents CHANGE type type VARCHAR(14) NOT NULL;

I traced this back to https://github.com/doctrine/orm/pull/9382. When I comment out line 787 in the SchemaTool this issue disappears:

https://github.com/doctrine/orm/pull/9382/files#diff-8be2a95c816ec2bcf28d186a4f18ef9fa4c48b849da2ae597e9d6d9398ca17f0R787

Looking at the changeset it might actually be more of a dbal issue, we're using 2.13.7...

Expected behavior

Well, no changes should be reported :)

Originally created by @bobvandevijver on GitHub (Feb 8, 2022). ### Bug Report <!-- Fill in the relevant information below to help triage your issue. --> | Q | A |------------ | ------ | BC Break | yes | Version | 2.11.1 #### Summary <!-- Provide a summary describing the problem you are experiencing. --> With 2.11.1 the database is reported as out of sync for enum based properties, while this does not happen with 2.11.0. #### Current behavior <!-- What is the current (buggy) behavior? --> The database schema is being reported as not being in sync. #### How to reproduce <!-- Provide steps to reproduce the bug. If possible, also add a code snippet with relevant configuration, entity mappings, DQL etc. Adding a failing Unit or Functional Test would help us a lot - you can submit one in a Pull Request separately, referencing this bug report. --> Consider the following property: ```php class Documents { #[ORM\Column(length: 14, enumType: DocumentType::class)] private DocumentType $type = DocumentType::GENERIC; } ``` with the enum being a string backed enum: ```php enum InstituteDocumentType: string { case GENERIC = 'generic'; case PROCEDURE = 'procedure'; } ``` See the following console output: ``` bobvandevijver@webdev81:/var/www/project$ bin/console doctrine:schema:update --dump-sql The following SQL statements will be executed: ALTER TABLE documents CHANGE type type VARCHAR(14) NOT NULL; bobvandevijver@webdev81:/var/www/project$ bin/console doctrine:schema:update --force Updating database schema... 7 queries were executed [OK] Database schema updated successfully! bobvandevijver@webdev81:/var/www/project$ bin/console doctrine:schema:update --dump-sql The following SQL statements will be executed: ALTER TABLE documents CHANGE type type VARCHAR(14) NOT NULL; ``` I traced this back to https://github.com/doctrine/orm/pull/9382. When I comment out line 787 in the SchemaTool this issue disappears: https://github.com/doctrine/orm/pull/9382/files#diff-8be2a95c816ec2bcf28d186a4f18ef9fa4c48b849da2ae597e9d6d9398ca17f0R787 Looking at the changeset it might actually be more of a dbal issue, we're using 2.13.7... #### Expected behavior <!-- What was the expected (correct) behavior? --> Well, no changes should be reported :)
admin closed this issue 2026-01-22 15:41:31 +01:00
Author
Owner

@bobvandevijver commented on GitHub (Feb 8, 2022):

I can confirm this does not happen with dbal 3.3.2, but it does happen with dbal 3.2.2.

@bobvandevijver commented on GitHub (Feb 8, 2022): I can confirm this does not happen with dbal 3.3.2, but it does happen with dbal 3.2.2.
Author
Owner

@greg0ire commented on GitHub (Feb 8, 2022):

Then I think we can close this instead of transferring to DBAL, because as you may or may not know DBAL 2 is being sunset. Also DBAL 3.2 is not maintained either.

@greg0ire commented on GitHub (Feb 8, 2022): Then I think we can close this instead of transferring to DBAL, because as you may or may not know [DBAL 2 is being sunset](https://www.doctrine-project.org/2022/01/22/sunsetting-dbal-2.html). Also DBAL 3.2 is not maintained either.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6927