改进 命名

This commit is contained in:
iVampireSP.com 2022-11-20 19:02:43 +08:00
parent 04b32ebb66
commit 3133463254
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -16,15 +16,17 @@ public function up()
Schema::table('hosts', function (Blueprint $table) {
//
$table->tinyInteger('hour')->index()->nullable()->after('status');
$table->tinyInteger('hour_at')->index()->nullable()->after('status');
});
echo PHP_EOL . '将开始刷新主机的小时数...';
Host::chunk(100, function ($hosts) {
foreach ($hosts as $host) {
$host->hour = $host->created_at->hour;
$host->hour_at = $host->created_at->hour;
$host->save();
}
});
echo ' 完成!' . PHP_EOL;
}
/**
@ -37,7 +39,7 @@ public function down()
Schema::table('hosts', function (Blueprint $table) {
//
$table->dropColumn('hour');
$table->dropColumn('hour_at');
});
}
};