【发布时间】:2019-02-12 04:24:35
【问题描述】:
如何解决这个问题?
错误:
SQLSTATE[42S02]:未找到基表或视图:1146 表 'softwareproject.o_r_f_o_l_s' 不存在(SQL:插入到 `o_r_f_o_l_s`(`region`、`user_id`、`updated_at`、`created_at` ) 值 (4165dsF, 3, 2018-09-06 20:33:58, 2018-09-06 20:33:58))
我的迁移:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateORFOLsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('o_r_f_o_ls', function (Blueprint $table) {
$table->increments('ORFOLId');
$table->string('region');
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('userId')->on('all_users');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('o_r_f_o_ls');
}
}
【问题讨论】:
-
这真的是表的名称,还是您为您的问题缩写了它? MySQL 中的表名有 64 个字符的限制。
-
您确定错误来自此迁移吗?错误在于插入,但此迁移没有任何插入。