N
N
Nubbin2017-10-03 09:03:53
MySQL
Nubbin, 2017-10-03 09:03:53

MYSQL Bypass errors?

Good morning guys when I load the tables into the database it 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 get around these errors? I really need help please!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Shamsudin Serderov, 2017-10-03
@Nubbin

If I understand correctly, this is Laravel.
in AppServiceProvider.php - add the following line:

public function boot() {
        Schema::defaultStringLength(191);
    }

A
Anton, 2017-10-03
@karminski

Yevgeny Samoylenko I think you are a little mistaken. The key name notifications_notifiable_id_notifiable_type_index is far from being 767 bytes. But its value, consisting of the values ​​of the two columns `notifiable_id`,`notifiable_type`, is probably longer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question