2014-12-02 2 views
0

내가 오류 BLaravel 마이그레이션 오류

자료 표 얻거나보기가 이미 존재 : 이미 1050 테이블 '범주' 이있는 '

무엇입니까? 왜? 오류를 찾는 방법? 내 카테고리 마이그레이션 파일 :

그 마이그레이션 파일에서
<?php 

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

class CategoriesTable extends Migration 
{ 

    /** 
    * Run the migrations. 
    * 
    * @return void 
    */ 
    public function up() 
    { 
     Schema::create('categories', function (Blueprint $table) { 

      $table->increments('id'); 

      $table->string('title')->index(); 
      $table->text('description'); 

      $table->integer('attachment_id')->unsigned()->index(); 
      $table->foreign('attachment_id')->references('id')->on('attachment')->onDelete('cascade'); 
      $table->timestamps(); 
     }); 
    } 

    /** 
    * Reverse the migrations. 
    * 
    * @return void 
    */ 
    public function down() 
    { 
     // 
    } 

} 
+0

는 소리 .. 당신이하지 않는 것을 확인했다? – msturdy

+0

테이블을 삭제해도 오류가 남아 있습니다. 해당되지 않습니다. – engilexial

+0

어떻게 테이블을 삭제 하시겠습니까? 마이 그 레이션 파일에'down()'메소드를 정의하지 않은 것 같아서, 장인이 테이블을 지우지 않을 것입니다. – msturdy

답변

0

, 함수 드롭() 그래서 당신이 기존의 테이블을 만들려고 할 것 같다

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

..

내가 생각해야한다 이미 설치 한 마이그레이션 파일을 편집하고 있습니다.

데이터베이스를 삭제하고 다시 마이그레이션 할 수 있습니다.

해당 테이블이 이미 DB에 존재처럼
php artisan migrate:reset 

php artisan migrate 
관련 문제