[feat] price history

This commit is contained in:
2026-03-12 22:31:10 -04:00
parent a8df9c71ee
commit e1ab59a2eb
3 changed files with 129 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
//import { mysqlTable, int, varchar, boolean, decimal, datetime, index } from "drizzle-orm/mysql-core"
import { integer, varchar, boolean, decimal, timestamp, index, pgSchema } from "drizzle-orm/pg-core";
import { integer, varchar, boolean, decimal, timestamp, index, pgSchema, uniqueIndex, primaryKey } from "drizzle-orm/pg-core";
export const pokeSchema = pgSchema("pokemon");
@@ -101,12 +101,12 @@ export const skus = pokeSchema.table('skus', {
]);
export const priceHistory = pokeSchema.table('price_history', {
skuId: integer().default(0).notNull(),
calculatedAt: timestamp(),
skuId: integer().notNull(),
calculatedAt: timestamp().notNull(),
marketPrice: decimal({ precision: 10, scale: 2 }),
},
(table) => [
index('idx_price_history').on(table.skuId, table.calculatedAt),
primaryKey({ name: 'pk_price_history', columns: [table.skuId, table.calculatedAt] })
]);
export const processingSkus = pokeSchema.table('processing_skus', {