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

iiCe89's avatar

String data, right truncated: 1406 Error

this is error i get when trying to submit post.

SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'body' at row 1 (SQL: insert into `documents`

here is migration table

public function up() {
        Schema::create('documents', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id');
            $table->integer('project_id');
            $table->string('name');
            $table->string('body');
            $table->timestamp('completed_at')->nullable()->default(null);
            $table->timestamps('timestamp');
        });
    }

you can see this live on website now if you wish to view complete error

https://signl.uk/login

email - [email protected]

Password - Laracast123

you will see Project called ( test Project ) and within that the Document tab with summernote editor which is where problem is

0 likes
4 replies
bobbybouwmann's avatar
Level 88

You need to upgrade your migration so your body column can hold more characters. Use text instead of string. String is only good for 256 characters out of my head.

$table->text('body');
3 likes

Please or to participate in this conversation.