Issue
I want to max the size of the row description. I already set size to 10240 but still it shows error. how to store data in this column because i have to save large amount of data
public function up()
{
Schema::create('final_news', function (Blueprint $table) {
$table->id();
$table->integer('id_newspaper');
$table->string('heading');
$table->string('description', 10240);
$table->timestamps();
});
}
ERROR I GET
SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'description' at row 1 (SQL: insert into `final_news` (`id_newspaper`, `heading`, `d
escription,
updated_at,
created_at`)
Solution
if string is long you can use longtext
$table->longText('description')
The longText
method creates a LONGTEXT
equivalent column:
Ref:https://laravel.com/docs/8.x/migrations#column-method-longText
Answered By - John Lobo Answer Checked By - Timothy Miller (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.