3
When I try to run a Migration on Laravel, the following error is generated:
[Illuminate Database Queryexception] SQLSTATE[HY000]: General error: 1709 Index column size Too large. The Maximum column size is 767 bytes. (SQ L: alter table
usuarios
add-onusuarios_email_unique
([Pdoexception] SQLSTATE[HY000]: General error: 1709 Index column size Too large. The Maximum column size is 767 bytes.
The sql being executed is this:
create table `usuarios` (
`id` int unsigned not null auto_increment primary key,
`nome` varchar(255) not null,
`email` varchar(255) not null,
`password` varchar(255) not null,
`nivel_id` int unsigned not null,
`empresa_id` int unsigned not null,
`departamento_id` int unsigned null,
`cargo_id` int unsigned null,
`status` tinyint(1) not null default '1',
`created_at` timestamp null,
`updated_at` timestamp null)
default character set utf8mb4 collate utf8mb4_unicode_ci
alter table `usuarios` add unique `usuarios_email_unique`(`email`)
alter table `usuarios` add index `usuarios_password_index`(`password`)
What could be generating this?
These are the settings of Mysql, I was also with this problem and solved through this link, see if it helps you: https://stackoverflow.com/questions/42043205/how-to-fix-mysql-index-column-size-too-large-laravel-migrate
– arllondias
This is because the email is too large to accept creating the index.unico. Solution diminiu the size from 255 to 100 will work I think also an exaggeration 255
– novic
@arllondias so worked kkkkk, I just switched the connection charset and worked correctly
– Wallace Maxters