【发布时间】:2021-03-12 03:58:45
【问题描述】:
我只是一个初学者,所以这个问题可能很愚蠢。 我在开发时使用 sqlite,当我在 AWS 上上传我的项目时,我收到了这个错误:-
SQLSTATE[HY000]: 一般错误: 1366 不正确的整数值: 'f2bbac78-d85f-42fd-ba4c-276c2d9ee2b6' 列 'confessedTo' 在第 1 行 (SQL: 插入到
confessions(confession, @987654323 @,confessionFrom,updated_at,created_at) 值 (AFCASCASCa, f2bbac78-d85f-42fd-ba4c-276c2d9ee2b6, 1, 2020-11-30 08:02:09, 2020-11-30 08:02: 09))
这是那张桌子:-
public function up()
{
Schema::create('confessions', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('confessedTo');
$table->unsignedBigInteger('confessionFrom');
$table->text('confession');
$table->string('name')->nullable();
$table->timestamps();
});
}
是因为我在我的confessedTo 列中传递了uuid 这是f2bbac78-d85f-42fd-ba4c-276c2d9ee2b6 这种类型的数据吗?
请帮忙
修改
我已将所有表格中的属性更改为uuid,但其中一个表格似乎无法正常工作,如下所列:-
之前:-
public function up()
{
Schema::create('messages', function (Blueprint $table) {
$table->id();
$table->integer('from')->unsigned();
$table->integer('to')->unsigned();
$table->text('text');
$table->string('list_no')->nullable();
$table->timestamps();
});
}
之后:-
public function up()
{
Schema::create('messages', function (Blueprint $table) {
$table->id();
$table->uuid('from');
$table->uuid('to');
$table->text('text');
$table->string('list_no')->nullable();
$table->timestamps();
});
}
这是我未读邮件的来源:-
public function up()
{
Schema::table('messages', function (Blueprint $table) {
$table->boolean('read')->after('to')->default(false);
});
}
错误:-
SQLSTATE[42S22]:找不到列:1054 未知列“读取”在“where 子句”中(SQL:选择
from作为 sender_id,计数(from)作为来自messages的 messages_count,其中to= f2bbac78-d85f-42fd-ba4c-276c2d9ee2b6 和read= 0 分组from)
请帮忙..
【问题讨论】:
-
是的。
confessedTocolum 只接受整数。但是您正在传递一个带有混合字符的字符串。所以将该列设为 uuid
标签: mysql laravel amazon-web-services sqlite