Created
January 25, 2021 16:03
-
-
Save dheysonalves/07943bc83b7cb50f17eab75d4d43108c to your computer and use it in GitHub Desktop.
Revisions
-
dheysonalves revised this gist
Jan 25, 2021 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,4 +23,6 @@ Para solucionar, deve ser editado o arquivo de boot dos serviços do laravel, de { Schema::defaultStringLength(191); } ``` Onde é determinado o tamanho padrão dos tipos string do banco de dados. -
dheysonalves created this gist
Jan 25, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ # Laravel Error - Specified key was too long error ## Problema Quando rodando versões antigas do Maria ou do MySql - antes da versão 5.7.7 -, o erro é disparado no console do Laravel na tentativa de popular o banco com migration. ```php [Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique(email)) [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes ``` ## Solução Para solucionar, deve ser editado o arquivo de boot dos serviços do laravel, dentro da pasta provider, *AppServiceProvider.php*, na função *boot()*. ```php use Illuminate\Support\Facades\Schema; public function boot() { Schema::defaultStringLength(191); } ```