java迁移文件下的文件_Laravel迁移 - 一次性多次迁移(文件)
說,我有多個遷移文件更新單個表 .
例如
2016_03_20_072730_create_tasks_table.php
2016_03_20_075467_create_tasks_table.php
......來自不同團隊成員的回購 . 每個人都在調整表中的內容,例如:添加一列 .
當我嘗試:
php artisan migrate
我收到錯誤:
PHP Fatal error: Cannot declare class CreateTasksTable, because the name is
eady in use in U:\www\b10\database\migrations\2016_03_20_072737_create_tasks_
le.php on line 30
[Symfony\Component\Debug\Exception\FatalErrorException]
Cannot declare class CreateTasksTable, because the name is already in use
如何應對如上所述的情況?
編輯
這是代碼:
2016_03_20_072730_create_tasks_table.php:
class CreateTasksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('tasks', function ($table)
{
$table->string('task1');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('tasks');
}
}
2016_03_20_075467_create_tasks_table.php:
class CreateTasksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('tasks', function ($table)
{
$table->string('task2');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('tasks');
}
}
總結
以上是生活随笔為你收集整理的java迁移文件下的文件_Laravel迁移 - 一次性多次迁移(文件)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java怎样生成文档_java中如何创建
- 下一篇: 韩文版ie8 启用java_只有在启用了