我正在尝试构建一个表,但是当我运行此命令“php artisan migrate”时出现此错误:
[照亮\数据库\ QueryException]
SQLSTATE [42S02]:未找到基表或视图:1146表'epharmacy.medici
nes ' doesn' t存在(SQL:alter table medicines
add id
int unsigned not not
null auto_increment主键,添加 name
varchar(255)not null,添加 typ e
varchar(255)not null,添加 potency
varchar(255)not null,添加 created _at
timestamp null,添加 updated_at
timestamp null
移民:
<?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) {
//
});
}
}
1 回答
根据the docs,它需要是:
}