import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core"; import { addresses } from "./addresses"; import { products } from "./products"; import { users } from "./users"; export const orders = sqliteTable("orders", { id: text("id").primaryKey(), orderNumber: text("order_number").notNull().unique(), customerId: text("customer_id").notNull().references(() => users.id), shippingAddressId: text("shipping_address_id").notNull().references(() => addresses.id), status: text("status").notNull(), notes: text("notes"), createdAt: text("created_at").notNull(), updatedAt: text("updated_at").notNull() }); export const orderItems = sqliteTable("order_items", { id: text("id").primaryKey(), orderId: text("order_id").notNull().references(() => orders.id), productId: text("product_id").notNull().references(() => products.id), quantity: integer("quantity").notNull(), unitPriceCents: integer("unit_price_cents").notNull() });