Spaces:
Sleeping
Sleeping
Download src/libs/shared/infrastructure/postgres/schema/inventoryLevels.ts from fouadkhalid123/asd: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/spaces/fouadkhalid123/asd/resolve/main/src/libs/shared/infrastructure/postgres/schema/inventoryLevels.ts
- Command line
-
hf download hf://spaces/fouadkhalid123/asd/src/libs/shared/infrastructure/postgres/schema/inventoryLevels.ts
-
curl -L -o inventoryLevels.ts https://huggingface.co/spaces/fouadkhalid123/asd/resolve/main/src/libs/shared/infrastructure/postgres/schema/inventoryLevels.ts
1.06 kB
| import { pgTable, uuid, text, timestamp, integer, index, unique } from "drizzle-orm/pg-core"; | |
| import { stores } from "../../../../../modules/shopify/infrastructure/postgres/schema/stores"; | |
| export const inventoryLevels = pgTable("inventory_levels", { | |
| id: uuid("id").primaryKey().defaultRandom(), | |
| storeId: uuid("store_id").notNull().references(() => stores.id, { onDelete: "cascade" }), | |
| inventoryItemId: text("inventory_item_id").notNull(), | |
| locationId: text("location_id").notNull(), | |
| available: integer("available").notNull().default(0), | |
| data: text("data"), | |
| updatedAt: timestamp("updated_at").defaultNow().notNull(), | |
| }, (t) => ({ | |
| storeIdx: index("idx_inventory_store").on(t.storeId), | |
| itemIdx: index("idx_inventory_item").on(t.inventoryItemId), | |
| uniqueConstraint: unique("uq_inventory_store_item_loc").on( | |
| t.storeId, | |
| t.inventoryItemId, | |
| t.locationId | |
| ), | |
| })); | |
| export type InventoryLevel = typeof inventoryLevels.$inferSelect; | |
| export type NewInventoryLevel = typeof inventoryLevels.$inferInsert; | |