import { relations } from "drizzle-orm"; import { boolean, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core"; import { comments } from "./comments"; import { markets } from "./markets"; import { eventTags } from "./tags"; export const events = pgTable("events", { id: uuid("id").primaryKey().defaultRandom(), slug: text("slug").notNull().unique(), title: text("title").notNull(), description: text("description"), resolutionSource: text("resolution_source"), active: boolean("active").notNull().default(true), closedAt: timestamp("closed_at", { withTimezone: true }), startDate: timestamp("start_date", { withTimezone: true }).notNull(), endDate: timestamp("end_date", { withTimezone: true }).notNull(), createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(), updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(), }); export const eventsRelations = relations(events, ({ many }) => ({ markets: many(markets), tags: many(eventTags), comments: many(comments), }));