【发布时间】:2017-07-22 13:45:54
【问题描述】:
我正在尝试构建一个表,但是当我运行此命令“php artisan migrate”时出现此错误:
[照亮\数据库\查询异常]
SQLSTATE [42S02]:未找到基表或视图:1146 表 'epharmacy.medici
nes' 不存在 (SQL: alter table medicines add id int unsigned not
null auto_increment 主键,加namevarchar(255) 不为空,加typvarchar(255) 不为空,加
epotencyvarchar(255) 不为空,加createdtimestamp null,加
_atupdated_attimestamp空)
迁移:
<?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) {
//
});
}
}
【问题讨论】:
-
将类名 createmedicinetable 更改为 criatemedicines 表并尝试
标签: php laravel-5.3