getherbert / herbert

The WordPress Plugin Framework:
http://getherbert.com/
631 stars 94 forks source link

Table Collation #127

Open moazam1 opened 8 years ago

moazam1 commented 8 years ago

I can't create a table because to this error:

Syntax error or access violation: 1253 COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'utf8mb4''

I think the easy fix is to replace following line:

'collation' => DB_COLLATE ?: 'utf8_general_ci',

with

'collation' => $wpdb->get_charset_collate() ?: 'utf8_general_ci',

in Framework\Providers\HerbertServiceProvider.php

Of course you have to add global $wpdb before $capsule->addConnection([

It's very simple change. If you want I can send PR.

For now I am going to use dbDelta :8ball:

VexedBun commented 8 years ago

I am also experiencing the above issue, have solved by taking the charset and collation values from $wpdb. Will create a pull request