Puphpet: Support `charset` property in `mysql.databases` configuration sets

Created on 12 Feb 2018  路  3Comments  路  Source: puphpet/puphpet

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?

Most helpful comment

@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.

All 3 comments

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.

@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.

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ethanf22 picture ethanf22  路  6Comments

rlweb picture rlweb  路  4Comments

Div-Man picture Div-Man  路  4Comments

alex-kusakin picture alex-kusakin  路  5Comments

MblKiTA picture MblKiTA  路  3Comments