Remove support for varcharmax

This was originally added in bd9f88587f (and further refined in 160ae441ff) as a workaround for issues in MySQL < 5.7 and MariaDB < 10.2 related to the default string length when using the recommended utf8mb4 database encoding.

As of Laravel 8 the minimum supported versions of MySQL and MariaDB are not affected by this issue so we're now removing this configuration / workaround in Winter v1.2.
This commit is contained in:
Luke Towers 2022-03-09 16:05:58 -06:00
parent ae5b0c2a54
commit 50417b2cb1
2 changed files with 0 additions and 24 deletions

View File

@ -58,7 +58,6 @@ return [
'unix_socket' => env('DB_SOCKET', ''),
'url' => env('DATABASE_URL'),
'username' => env('DB_USERNAME', 'winter'),
'varcharmax' => 191,
],
'pgsql' => [

View File

@ -83,9 +83,6 @@ class ServiceProvider extends ModuleServiceProvider
*/
public function boot()
{
// Fix UTF8MB4 support for MariaDB < 10.2 and MySQL < 5.7
$this->applyDatabaseDefaultStringLength();
// Fix use of Storage::url() for local disks that haven't been configured correctly
foreach (Config::get('filesystems.disks') as $key => $config) {
if ($config['driver'] === 'local' && ends_with($config['root'], '/storage/app') && empty($config['url'])) {
@ -610,24 +607,4 @@ class ServiceProvider extends ModuleServiceProvider
{
View::share('appName', Config::get('app.name'));
}
/**
* Fix UTF8MB4 support for old versions of MariaDB (<10.2) and MySQL (<5.7)
*/
protected function applyDatabaseDefaultStringLength()
{
if (Db::getDriverName() !== 'mysql') {
return;
}
$defaultStrLen = Db::getConfig('varcharmax');
if ($defaultStrLen === null && Db::getConfig('charset') === 'utf8mb4') {
$defaultStrLen = 191;
}
if ($defaultStrLen !== null) {
Schema::defaultStringLength((int) $defaultStrLen);
}
}
}