改进 命名
This commit is contained in:
parent
04b32ebb66
commit
3133463254
@ -16,15 +16,17 @@ public function up()
|
|||||||
Schema::table('hosts', function (Blueprint $table) {
|
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) {
|
Host::chunk(100, function ($hosts) {
|
||||||
foreach ($hosts as $host) {
|
foreach ($hosts as $host) {
|
||||||
$host->hour = $host->created_at->hour;
|
$host->hour_at = $host->created_at->hour;
|
||||||
$host->save();
|
$host->save();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
echo ' 完成!' . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,7 +39,7 @@ public function down()
|
|||||||
Schema::table('hosts', function (Blueprint $table) {
|
Schema::table('hosts', function (Blueprint $table) {
|
||||||
//
|
//
|
||||||
|
|
||||||
$table->dropColumn('hour');
|
$table->dropColumn('hour_at');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user