[feat] price history
This commit is contained in:
@@ -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', {
|
||||
|
||||
Reference in New Issue
Block a user