gpt4 book ai didi

mysql - SQLSTATE[42000] : Syntax error or access violation error on mysql

转载 作者:行者123 更新时间:2023-11-29 21:13:57 24 4
gpt4 key购买 nike

编译数据库时出错,不知道要修复什么。它没有给我关于 sqlite 的警告,但它在 mysql 上发出警告。

Schema::create('question', function(Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->softDeletes();
$table->text('title')->index();
$table->string('hint')->nullable();
$table->text('explanation')->nullable();
$table->string('referencematerial')->nullable();
$table->string('imagepath')->nullable();
$table->boolean('published')->default(1);
});




[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1
170 BLOB/TEXT column 'title' used in key specificati
on without a key length (SQL: alter table `question`
add index `question_title_index`(`title`))



[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1
170 BLOB/TEXT column 'title' used in key specificati
on without a key length

最佳答案

无法在mysql中将TEXT字段索引为索引,参见相关question

一种解决方案是将标题创建为 varchar,如 varchar(200)

关于mysql - SQLSTATE[42000] : Syntax error or access violation error on mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36119286/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com