Reputation: 53
Im new to Laravel, trying to use Laravel mediable package but it gives me an error on migration -> "[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table media
add unique media_disk_directory_filen
ame_extension_unique
(disk
, directory
, filename
, extension
))
[PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes"
Im on Laravel 5.4.36, the solution on other sites is to add this ->
public function boot()
{
//
Schema::defaultStringLength(191);
}
but i already have this in my project.
can anybody please help?
Upvotes: 1
Views: 586
Reputation: 39
this work with me, Inside config/database.php i replace this 'engine' => null', with : engine' => 'InnoDB ROW_FORMAT=DYNAMIC',
this solution Instead of setting a limit on your string lenght.
Upvotes: 0
Reputation: 163948
You can try to fix this by canging engine
value in config/database.php
config file:
'engine' => 'InnoDB ROW_FORMAT=DYNAMIC',
If you want to use this fix:
Schema::defaultStringLength(191);
Make sure you've registered this service provider in config/app.php
Upvotes: 4