feat: add fuel:archive command and monthly scheduler entry
Completes Tasks 12 + 13 from docs/superpowers/plans/2026-04-03-fuel-api-ingestion.md. - ArchiveOldPricesCommand moves station_prices rows older than 12 months into station_prices_archive in chunks of 1000, wrapping each chunk's insert + delete in a DB::transaction so a partial failure can't duplicate rows. - StationPriceArchive: add $table = 'station_prices_archive'; without it Eloquent infers 'station_price_archives' and the insert would fail. - routes/console.php: register fuel:archive monthly on the 1st at 04:00 UTC, alongside the other fuel/oil scheduler entries. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,15 +10,17 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
#[Fillable(['station_id', 'fuel_type', 'price_pence', 'price_effective_at', 'price_reported_at', 'recorded_at'])]
|
||||
class StationPriceArchive extends Model
|
||||
{
|
||||
protected $table = 'station_prices_archive';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'fuel_type' => FuelType::class,
|
||||
'fuel_type' => FuelType::class,
|
||||
'price_effective_at' => 'datetime',
|
||||
'price_reported_at' => 'datetime',
|
||||
'recorded_at' => 'datetime',
|
||||
'price_reported_at' => 'datetime',
|
||||
'recorded_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user