我剛剛創建了一個新的遷移文件,爲現有表插入一個新列。laravel 5運行新創建的鏡像文件時出現遷移錯誤
文件代碼:
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddStatusToPhoto extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('photos', function(Blueprint $table)
{
$table->integer('status');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
但是當我運行PHP的工匠遷移,有一個錯誤信息:
[Illuminate\Database\QueryException]
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'permission_
role' already exists (SQL: create table `permission_role` (`id` int unsigne
d not null auto_increment primary key, `permission_id` int unsigned not nul
l, `role_id` int unsigned not null, `created_at` timestamp default 0 not nu
ll, `updated_at` timestamp default 0 not null) default character set utf8 c
ollate utf8_unicode_ci)
人知道是什麼問題?
在你permission_role遷移腳本,不得不在屋裏'向下()'添加刪除表? –
我注意到permission_role表沒有回滾,Aldo當我手動刪除它,同樣的錯誤仍然存在。 –