我有一个数据库表locations,我需要添加一个新status列。我已经设置了以下迁移文件,它在我运行时添加了该字段php artisan migrate,但是如何Active为表中的每一行插入一个值?
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddStatusToLocationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('locations', function(Blueprint $table)
{
$table->string('status')->after('email');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('locations', function(Blueprint $table)
{
$table->dropColumn('status');
});
}
}
Run Code Online (Sandbox Code Playgroud)