Skip to content

Fixed charset on SQL dump from YAML schema#38

Open
adriendupuis wants to merge 1 commit into
5.0from
fix-file-schema-charset
Open

Fixed charset on SQL dump from YAML schema#38
adriendupuis wants to merge 1 commit into
5.0from
fix-file-schema-charset

Conversation

@adriendupuis

@adriendupuis adriendupuis commented Dec 5, 2025

Copy link
Copy Markdown
🎫 Issue IBX-XXXXX

Description:

Inject the default table options into the schema imported from file.

It avoids having DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` from https://github.com/doctrine/dbal/blob/3.10.x/src/Platforms/AbstractMySQLPlatform.php#L579-L600 when using ibexa:doctrine:schema:dump-sql on files like https://github.com/ibexa/oauth2-server/blob/main/src/bundle/Resources/config/schema.yaml or https://github.com/ibexa/shopping-list/blob/main/src/bundle/Resources/config/schema.yaml

Notice that it might disappear by itself if we move to doctrine/dbal 4 as there is no hardcoded charset in https://github.com/doctrine/dbal/blob/4.4.x/src/Platforms/AbstractMySQLPlatform.php#L331-L337

For QA:

Documentation:

@sonarqubecloud

sonarqubecloud Bot commented Dec 5, 2025

Copy link
Copy Markdown

@adriendupuis adriendupuis force-pushed the fix-file-schema-charset branch from 7f6327c to 75fba3e Compare February 20, 2026 11:39
@sonarqubecloud

Copy link
Copy Markdown

@alongosz alongosz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adriendupuis sorry for the delay with the review. The whole point of default table options was to avoid necessity of explicitly defining them for each table. I think the root cause of this issue is the fact that schema importer doesn't create a proper config.

I can give you more detailed instructions, but I need a simple steps to reproduce. Installing oauth2-server for this seems very complicated. If this is the only case which fails, then I'll try to do it, but please include some steps. Maybe there's more simple use case?

@adriendupuis

Copy link
Copy Markdown
Author

@alongosz Sorry for the late reply.

I encountered this while doing ddev php bin/console ibexa:doctrine:schema:dump-sql vendor/ibexa/shopping-list/src/bundle/Resources/config/schema.yaml | ddev mysql but in fact you can test it on any schema.yaml with just looking at the output.

% php bin/console ibexa:doctrine:schema:dump-sql vendor/ibexa/core/src/bundle/Core/Resources/config/storage/legacy/schema.yaml | grep COLLATE;
CREATE TABLE ibexa_binary_file (contentobject_attribute_id INT DEFAULT 0 NOT NULL, version INT DEFAULT 0 NOT NULL, download_count INT DEFAULT 0 NOT NULL, filename VARCHAR(255) DEFAULT '' NOT NULL, mime_type VARCHAR(255) DEFAULT '' NOT NULL, original_filename VARCHAR(255) DEFAULT '' NOT NULL, PRIMARY KEY(contentobject_attribute_id, version)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB;

You won't see the DATABASE_CHARSET value (utf8mb4 or whatever) but always utf8.

@sonarqubecloud

Copy link
Copy Markdown

@mnocon mnocon changed the base branch from main to 5.0 April 29, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants