MYSQL to get Around the error?

Good morning guys when you load tables into the database comes out.

ALTER TABLE `notifications`
 ADD PRIMARY KEY (`id`),
 ADD KEY `notifications_notifiable_id_notifiable_type_index` (`notifiable_id`,`notifiable_type`);


#1071 - Specified key was too long; max key length is 767 bytes

How can I bypass these errors? Really need help please!
June 14th 19 at 20:30
2 answers
June 14th 19 at 20:32
Solution
If I understand correctly this is Laravel.

in AppServiceProvider.php - add the following line:
public function boot() {
Schema::defaultStringLength(191);
 }
June 14th 19 at 20:34
I think you are a little misguided. The name of the key notifications_notifiable_id_notifiable_type_index not 767 bytes. But its value consisting of the values of two columns notifiable_id`,`notifiable_type` - probably longer.
Yeah, removed. You are right. - john32 commented on June 14th 19 at 20:37

Find more questions by tags MySQL