boolean('personal')->default(0)->after('userid')->nullable()->comment('是否个人项目'); } }); if ($isAdd) { // 更新数据 \App\Models\Project::where('name','like', '%个人项目%')->chunkById(100, function ($lists) { /** @var \App\Models\Project $item */ foreach ($lists as $item) { if ($item->desc == '注册时系统自动创建项目,你可以自由删除。') { $item->personal = 1; $item->save(); } } }); } } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table('projects', function (Blueprint $table) { $table->dropColumn("personal"); }); } }