2017-03-02 56 views
0

我想建一個表,但是當我運行此命令「PHP工匠移民」這個錯誤發生:基表或視圖未找到:1146表「epharmacy.medicines」不存在

[照亮\數據庫\ QueryException]
SQLSTATE [42S02]:基表或視圖未找到:1146表 'epharmacy.medici
未列名' 不存在(SQL:改變表medicines添加id INT無符號不
空AUTO_INCREMENT主鍵,加name varchar(255)不爲空,加typ
e
varchar(255)不爲空,加potency varchar(255)not nul L,加created
_at
時間戳空,加updated_at時間戳空)

遷移:

<?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) { 
      // 
     }); 
    } 
} 
+0

變化類名createmedicinetable到criatemedicines表和嘗試 – ashanrupasinghe

回答

0

the docs,它需要:

<?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'); 
    }  

}

相關問題