Php 找不到基表或视图:1146表';epharmacy.药物';不';不存在
我正在尝试构建一个表,但当我运行此命令“php artisan migrate”时,出现以下错误: [照亮\数据库\查询异常]Php 找不到基表或视图:1146表';epharmacy.药物';不';不存在,php,laravel-5.3,Php,Laravel 5.3,我正在尝试构建一个表,但当我运行此命令“php artisan migrate”时,出现以下错误: [照亮\数据库\查询异常] SQLSTATE[42S02]:未找到基表或视图:1146表的epharmacy.medici “nes”不存在(SQL:alter tablemedicinesaddidint unsigned not 空自动递增主键,添加namevarchar(255)非空,添加typ evarchar(255)不为空,添加potencyvarchar(255)不为空,添加crea
SQLSTATE[42S02]:未找到基表或视图:1146表的epharmacy.medici
“nes”不存在(SQL:alter table
medicines
addid
int unsigned not空自动递增主键,添加
name
varchar(255)非空,添加typ
e
varchar(255)不为空,添加potency
varchar(255)不为空,添加created
_在
timestampnull处,添加updated\u在timestampnull处)
迁移:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMedicineTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('medicines', function (Blueprint $table) {
$table->increments('id');
$table->String('name');
$table->String('type');
$table->String('potency');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('medicines', function (Blueprint $table) {
//
});
}
}
根据,它需要:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMedicineTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('medicines', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('type');
$table->string('potency');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('medicines');
}
将类名createmedicinetable更改为criatemedicines表,然后重试