This commit is contained in:
iVampireSP.com 2023-03-08 01:01:19 +08:00
parent b7632c5153
commit 8542b02493
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -29,11 +29,15 @@ public function up(): void
$table->timestamp('expired_at')->nullable()->after('last_paid_at');
});
$hosts = Host::all();
$count = $hosts->count();
// 为已有的主机设置默认值
Host::all()->each(function (Host $host) {
Host::all()->each(function (Host $host) use (&$count) {
echo "Migrating {$host->id} ({$host->name})... {$count} left".PHP_EOL;
$host->day_at = $host->created_at->day;
$host->save();
$host->saveQuietly();
});
}