Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Support charset property in mysql.databases configuration sets #2753

Open
huebs opened this issue Feb 12, 2018 · 3 comments
Open

Support charset property in mysql.databases configuration sets #2753

huebs opened this issue Feb 12, 2018 · 3 comments

Comments

@huebs
Copy link

huebs commented Feb 12, 2018

Currently, a charset parameter present in any MySQL database configuration in config.yaml gets passed to the MySQL module where it's already supported.

I personally find this hidden feature useful because I often use utf8mb4.

I've also confirmed that setting the collate key to utf8mb4_general_ci or utf8mb4_unicode_ci doesn't change the default charset from utf8 to utf8mb4. Unless the charset is specifically set to utf8mb4, using either of utf8mb4_* collations will lead provisioning to fail.

From what I can tell, fully supporting this feature requires making only two changes:

In src/PuphpetBundle/Resources/config/mysql/defaults.yml, change:

databases:
    database1:
        name: dbname
        collate: utf8_general_ci
        sql: ~

To:

databases:
    database1:
        name: dbname
        charset: utf8
        collate: utf8_general_ci
        sql: ~

And in src/PuphpetBundle/Resources/views/mysql/database.html.twig, add:

    <div class="form-group col-xs-12 col-sm-6">
        <label for="{{ idBase }}-charset">
            DB Charset
        </label>
        <input type="text" id="{{ idBase }}-charset"
               name="{{ nameBase }}[charset]"
               placeholder="utf8" class="form-control"
               value="{{ database.charset }}" />
    </div>

Is there a reason this isn't officially supported that I'm not seeing? Is there more to fully implementing support than what I've outlined? Would you accept a pull request with these changes?

@jtreminio
Copy link
Member

Is there a reason this isn't officially supported that I'm not seeing?

Every module on puphpet has many more features than what's visible in the GUI. Adding all those options, though, would quickly make the GUI overwhelming.

I'd accept PRs, especially for something like this.

@huebs
Copy link
Author

huebs commented Feb 12, 2018

@jtreminio thanks for the quick response! I should have time this afternoon in two weeks to create a PR.

In addition to adding the DB Charset field described above, I'd also rename the DB Encoding field to DB Collation for clarity.

huebs added a commit to huebs/puphpet that referenced this issue Mar 1, 2018
 * Add `DB Charset` field to MySQL database configuration so a custom `charset` can be used.
 * Renamed `DB Encoding` field to `DB Collation` for improved clarity.
@huebs
Copy link
Author

huebs commented Mar 20, 2018

@jtreminio just making sure you'd seen my pull request (#2761). Please let me know if there's anything you'd like changed in order to accept it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants