import { text, integer, timestamp, pgTable, primaryKey } from "drizzle-orm/pg-core";
export const metadata = {
createdAt: timestamp("created_at").defaultNow(),
updatedAt: timestamp("updated_at").defaultNow().$onUpdate(() => new Date()),
};
export const eventItemPrice = pgTable(
"event_item_price",
{
eventId: text("event_id")
.notNull()
.references(() => event.id, { onDelete: "cascade" }),
itemId: text("item_id")
.notNull()
.references(() => item.id, { onDelete: "cascade" }),
price: integer("price"),
token_price: integer("token_price"),
...metadata,
},
(table) => [
primaryKey({ columns: [table.eventId, table.itemId] }),
]
);
import { text, integer, timestamp, pgTable, primaryKey } from "drizzle-orm/pg-core";
export const metadata = {
createdAt: timestamp("created_at").defaultNow(),
updatedAt: timestamp("updated_at").defaultNow().$onUpdate(() => new Date()),
};
export const eventItemPrice = pgTable(
"event_item_price",
{
eventId: text("event_id")
.notNull()
.references(() => event.id, { onDelete: "cascade" }),
itemId: text("item_id")
.notNull()
.references(() => item.id, { onDelete: "cascade" }),
price: integer("price"),
token_price: integer("token_price"),
...metadata,
},
(table) => [
primaryKey({ columns: [table.eventId, table.itemId] }),
]
);