cs-prices: price history backfill (Steam daily median since 2013 from the public listing page, CSFloat daily averages, ECB FX history) in separate *-history streams; labelled on item charts
All checks were successful
Deploy production / deploy (push) Successful in 1m13s

This commit is contained in:
2026-10-26 09:32:55 +00:00
parent 7396d23335
commit 76f063b362
5 changed files with 42972 additions and 2 deletions

View File

@@ -185,3 +185,21 @@ export const csFxRates = csSchema.table('fx_rates', {
day: date('day').primaryKey(),
usdEur: numeric('usd_eur', { precision: 12, scale: 8 }).notNull()
});
// Backfill bookkeeping (scripts/cs-history.ts): which config was fetched from which history
// source, so the slow, throttled backfill can resume. History rows themselves live in
// daily_prices under their own streams (kind ending in `-history`).
export const csHistoryFetches = csSchema.table(
'history_fetches',
{
itemId: integer('item_id')
.notNull()
.references(() => csMarketItems.id, { onDelete: 'cascade' }),
source: text('source').notNull(),
fetchedAt: timestamp('fetched_at', { withTimezone: true }).notNull().defaultNow(),
points: integer('points').notNull().default(0),
firstDay: date('first_day'),
error: text('error')
},
(table) => [primaryKey({ name: 'history_fetches_pkey', columns: [table.itemId, table.source] })]
);