preciazo/db-datos/schema.ts

25 lines
756 B
TypeScript
Raw Normal View History

2023-12-25 16:33:11 +00:00
import { index, integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
2023-12-21 17:00:00 +00:00
2023-12-25 16:33:11 +00:00
export const precios = sqliteTable(
"precios",
{
id: integer("id", { mode: "number" }).primaryKey({ autoIncrement: true }),
ean: text("ean").notNull(),
fetchedAt: integer("fetched_at", { mode: "timestamp" }).notNull(),
precioCentavos: integer("precio_centavos"),
inStock: integer("in_stock", { mode: "boolean" }),
url: text("url").notNull(),
warcRecordId: text("warc_record_id"),
parserVersion: integer("parser_version"),
name: text("name"),
imageUrl: text("image_url"),
},
(precios) => {
return {
preciosEanIdx: index("precios_ean_idx").on(precios.ean),
};
}
);
2023-12-23 23:14:05 +00:00
export type Precio = typeof precios.$inferSelect;