Skip to content

Doctrine generated SQL unaffected by recipe dbal charset utf8mb4 #368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2018
Merged

Doctrine generated SQL unaffected by recipe dbal charset utf8mb4 #368

merged 1 commit into from
Mar 20, 2018

Conversation

felixgomez
Copy link
Contributor

@felixgomez felixgomez commented Feb 18, 2018

Q A
License MIT

Currently the yaml configuration in the doctrine recipe assigns the charset value to utf8mb4:

doctrine:
    dbal:
        # configure these for your database server
        driver: 'pdo_mysql'
        server_version: '5.7'
        charset: utf8mb4

But this does not affect the configuration of doctrine generated SQL as charset and collation of the tables don't inherit this default charset database value.

So SQL generated through doctrine:schema:update --dump-sql keeps adding DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci by table.

This is true even if mysql server is configured to use utf8mb4 by default or ?charset=utf8mb4 is added to DATABASE_URL env variable.

IMHO it would be better to change the defaults for doctrine recipe so generated SQL really uses utf8mb4 by table.

doctrine:
    dbal:
        # configure these for your database server
        driver: 'pdo_mysql'
        server_version: '5.7'
        charset: utf8mb4
        default_table_options:
            charset: utf8mb4
            collate: utf8mb4_unicode_ci

@felixgomez
Copy link
Contributor Author

felixgomez commented Feb 20, 2018

I see that this is related to doctrine/dbal#3003

@weaverryan
Copy link
Member

Hmm, so we could add it now, and remove it later when DBAL 2.7 is out

@keichinger
Copy link

I'm in favour of merging this.

Copy link
Member

@weaverryan weaverryan left a comment

Choose a reason for hiding this comment

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

Yea, I like this

@fabpot
Copy link
Member

fabpot commented Mar 20, 2018

merge now

@fabpot fabpot merged commit 4ccc108 into symfony:master Mar 20, 2018
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.

6 participants