如何最大化 laravel 中的行大小 | mysql
How to maximize the row size in laravel | mysql
我想最大化行描述的大小。我已经将大小设置为 10240,但它仍然显示错误。由于我要保存大量数据,如何将数据存储在此列中
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();
});
}
我收到错误
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
说明,
updated_at,
created_at`)
如果字符串很长你可以使用 longtext
$table->longText('description')
longText
方法创建一个 LONGTEXT
等效列:
参考:https://laravel.com/docs/8.x/migrations#column-method-longText
我想最大化行描述的大小。我已经将大小设置为 10240,但它仍然显示错误。由于我要保存大量数据,如何将数据存储在此列中
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();
});
}
我收到错误
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
说明,
updated_at,
created_at`)
如果字符串很长你可以使用 longtext
$table->longText('description')
longText
方法创建一个 LONGTEXT
等效列:
参考:https://laravel.com/docs/8.x/migrations#column-method-longText