2016-07-06 80 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'); 
}