The issue I run into is that when I run my database migrations I get an error when the charset is utf8mb4
due to this line and some other indexes:
$table->string('taggable_type', 255)->index();
So, I thought that if I can modify the charset that is being used to utf8 in config/database.php by checking which MySQL version is used, the issue can be solved/worked around.
I was thinking about doing a raw query like:
\Illuminate\Support\Facades\DB::raw('SHOW VARIABLES LIKE "%version%"');
inside config/database.php
. Now that error I receive is that
A facade root has not been set.
How can I solve this issue?
Yes, I have tried setting Schema::defaultStringLength(191);
inside the boot method of my AppServiceProvider and I have also tried 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC'
, but I still receive that the specified key is too long which I believe might be due to MySQL 5.5 I believe.
Any help as to how I can check the MySQL version inside a config file or a hint to a different approach would be highly appreciated.