Can i add unique constraint to LongText column in laravel. I mean, for example i have table having body column with LongText datatype, then how i can make it unique.
$table->LongText('body')->unique();
When i do this it will generate the following SQL error.
Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 'long_questi
on' used in key specification without a key length (SQL: alter table `long_questions` add unique `long_questions_long_question
_unique`(`long_question`))
I need need a solution for this to make a LongText column unique... please give me any suggestion.
According to me. You can't make text
to unique
.
string
can be .
$table->string('sensitive_string', 255)->unique();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With