2016-07-06 27 views
0

我有2個遷移表,我成功遷移了它們。但我忘了添加一些東西,所以我試圖回滾laravel migration:回滾給出錯誤

php artisan migrate:rollback 

在這個命令後,我收到了這些錯誤。

[照亮\數據庫\ QueryException] SQLSTATE [42S02]:基表或視圖未找到:1051未知表 '表名'(SQL:刪除表table name

[PDOException] SQLSTATE [ 42S02]:未找到基本表或視圖:1051未知表'表名'

遷移已成功。但是當我回滾時,找不到我剛剛遷移的表。

<?php 

use Illuminate\Database\Schema\Blueprint; 
use Illuminate\Database\Migrations\Migration; 

class OnlineDiyet extends Migration 
{ 
/** 
* Run the migrations. 
* 
* @return void 
*/ 
public function up() 
{ 
    Schema::create('online_diyet',function (Blueprint $table){ 
     $table->increments('id'); 


     $table->string('bilgi'); 
     $table->rememberToken(); 
     $table->timestamps(); 

    }); 
} 

/** 
* Reverse the migrations. 
* 
* @return void 
*/ 
public function down() 
{ 
    Schema::drop('online_diyet'); 
} 

}

,這是我的第二A表

<?php 

use Illuminate\Database\Schema\Blueprint; 
use Illuminate\Database\Migrations\Migration; 

    class Doctors extends Migration 
    { 
/** 
* Run the migrations. 
* 
* @return void 
*/ 
    public function up() 
    { 
    Schema::create('doctors',function (Blueprint $table) { 

     $table->increments('id'); 
     $table->string('email'); 
     $table->boolean('mailat',1); 
     $table->rememberToken(); 
     $table->timestamps(); 


    });   
} 

/** 
* Reverse the migrations. 
* 
* @return void 
*/ 
public function down() 
{ 
    Schema::drop('online_diyet'); 

} 

}

+0

你能告訴我們您的遷移文件? – 2016-07-06 14:54:10

+0

here:http://hizliresim.com/OM599z – Gvep

+0

@AliYiğit整個遷移文件包括向上和向下 – apokryfos

回答

0

在你的第二個遷移,將down方法裏面,你滴速表online_diyet以前滴速在你的第一次遷移。

它應該是:

public function down() 
{ 
    Schema::drop('doctors'); 
}