Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

diogomfm's avatar

Syntax error or access violation: 1170 BLOB/TEXT column 'e mail' used in key specification without a key length

When I try migrate appear me this error.

[Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 'e mail' used in key specification without a key length (SQL: alter table pas sword_resets add index password_resets_email_index(email))

[PDOException] SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 'e mail' used in key specification without a key length

Migrate three tables migration, users and passwords resets, but dont migrate a table I create. Can you help me?

0 likes
2 replies
jivanrij's avatar

I got this issue when I wanted to encrypt the mail address and therefor needed a text field for the mail address. I solved it by removing the unique from $table->text('email'); and putting the unique on it with a separate statement.

DB::unprepared('ALTER TABLE users ADD UNIQUE key users_email_unique (email(64))');
2 likes

Please or to participate in this conversation.