-
Notifications
You must be signed in to change notification settings - Fork 59
Description
Q | A |
---|---|
auditor version |
3.3.3 - auditor-bundle 6.2.1 |
PHP version | 8.2 |
Database | PostgreSQL 16 |
Summary
When using PostgreSQL 16 with UTF8 charset and collation, schema updates are continuously being triggered despite no actual schema changes existing.
Current behavior
The database schema is continuously being flagged for updates when using the migration system, causing unnecessary migration files to be generated. Upon debugging in the Comparator, the issue appears to be with the Platform Options - specifically with charset and collation for PostgreSQL 16.
The debug output shows that while oldColumn._platformOptions is {array[0]} (empty), newColumn._platformOptions contains {array[2]} with charset and collate both set to "UTF8".
oldColumn = {Doctrine\DBAL\Schema\Column}
_name = "ip"
_namespace = null
_quoted = false
_type = {Doctrine\DBAL\Types\StringType}
_length = {int} 45
_precision = null
_scale = {int} 0
_unsigned = false
_fixed = false
_notnull = false
_default = null
_autoincrement = false
_values = {array[0]}
_platformOptions = {array[0]}
newColumn = {Doctrine\DBAL\Schema\Column}
_name = "ip"
_namespace = null
_quoted = false
_type = {Doctrine\DBAL\Types\StringType}
_length = {int} 45
_precision = null
_scale = {int} 0
_unsigned = false
_fixed = false
_notnull = false
_default = null
_autoincrement = false
_values = {array[0]}
_platformOptions = {array[2]}
charset = "UTF8"
collate = "UTF8"
This difference in platform options causes the schema comparator to believe there's a change requiring migration, even though functionally nothing has changed.
How to reproduce
- Set up a Symfony 7.2 project with auditor-bundle ^6.0
- Configure PostgreSQL 16 database with UTF8 charset and collation
- Create a basic entity with auditing enabled
- Run bin/console doctrine:migrations:diff
- Apply migration
- Run bin/console doctrine:migrations:diff again without making any schema changes
- Observe that a new migration is generated despite no actual changes
Expected behavior
The schema comparator should properly handle PostgreSQL 16's default UTF8 charset and collation settings, and not flag them as differences requiring migration when no actual schema changes exist. After running a migration, subsequent doctrine:migrations:diff commands should not generate new migrations if no entity changes were made.