pull/4087/head
Daniel Supernault 2023-01-14 21:26:41 -07:00
rodzic f5c2120eee
commit 87cff47c03
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 0DEF1C662C9033F7
1 zmienionych plików z 39 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use App\Profile;
use App\User;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
User::whereNull('profile_id')
->chunk(20, function($users) {
foreach($users as $user) {
$profile = Profile::whereUsername($user->username)->first();
if($profile) {
$user->profile_id = $profile->id;
$user->save();
}
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
};